mini_arcade_core.spaces.d2.physics2d

Simple 2D physics utilities.

Classes

Velocity2D

Simple 2D velocity vector.

Module Contents

class mini_arcade_core.spaces.d2.physics2d.Velocity2D[source]

Simple 2D velocity vector.

Variables:
  • (float) (vy) – Velocity in the X direction.

  • (float) – Velocity in the Y direction.

vx: float = 0.0
vy: float = 0.0
to_tuple() tuple[float, float][source]

Convert Velocity2D to a tuple.

Returns:

Tuple of (vx, vy).

Return type:

tuple[float, float]

advance(x: float, y: float, dt: float) tuple[float, float][source]

Return new (x, y) after dt seconds.

stop()[source]

Stop movement in both axes.

stop_x()[source]

Stop horizontal movement.

stop_y()[source]

Stop vertical movement.

move_up(speed: float)[source]

Set vertical velocity upwards (negative Y).

Parameters:

speed (float) – Speed to set.

move_down(speed: float)[source]

Set vertical velocity downwards (positive Y).

Parameters:

speed (float) – Speed to set.

move_left(speed: float)[source]

Set horizontal velocity to the left (negative X).”

Parameters:

speed (float) – Speed to set.

move_right(speed: float)[source]

Set horizontal velocity to the right (positive X).

Parameters:

speed (float) – Speed to set.