mini_arcade_core.spaces.d2.boundaries2d

Boundary behaviors for 2D rectangular objects.

This module is transitional: - Supports the legacy d2 model (position, size, velocity) - Supports the new model (transform, kinematic)

Classes

LegacyRectKinematic

Legacy contract for something that can bounce.

RectKinematic

New contract for something that can bounce.

VerticalBounce

Bounce an object off the top/bottom bounds by inverting vertical velocity

LegacyRectSprite

Legacy contract for something that can wrap.

RectSprite

New contract for something that can wrap.

VerticalWrap

Wrap an object top <-> bottom.

Module Contents

class mini_arcade_core.spaces.d2.boundaries2d.LegacyRectKinematic

Bases: Protocol

Legacy contract for something that can bounce.

position: mini_arcade_core.spaces.geometry.bounds.Position2D
size: mini_arcade_core.spaces.geometry.bounds.Size2D
velocity: mini_arcade_core.spaces.d2.physics2d.Velocity2D
class mini_arcade_core.spaces.d2.boundaries2d.RectKinematic[source]

Bases: Protocol

New contract for something that can bounce.

Note: - In the current engine usage, transform.center is treated as top-left.

transform: mini_arcade_core.spaces.geometry.transform.Transform2D
kinematic: mini_arcade_core.spaces.physics.kinematics2d.Kinematic2D
class mini_arcade_core.spaces.d2.boundaries2d.VerticalBounce[source]

Bounce an object off the top/bottom bounds by inverting vertical velocity and clamping its position inside bounds.

bounds: mini_arcade_core.spaces.geometry.bounds.Bounds2D
apply(obj: RectKinematic | LegacyRectKinematic) bool[source]

Apply vertical bounce to the given object.

class mini_arcade_core.spaces.d2.boundaries2d.LegacyRectSprite[source]

Bases: Protocol

Legacy contract for something that can wrap.

position: mini_arcade_core.spaces.geometry.bounds.Position2D
size: mini_arcade_core.spaces.geometry.bounds.Size2D
class mini_arcade_core.spaces.d2.boundaries2d.RectSprite[source]

Bases: Protocol

New contract for something that can wrap.

transform: mini_arcade_core.spaces.geometry.transform.Transform2D
class mini_arcade_core.spaces.d2.boundaries2d.VerticalWrap[source]

Wrap an object top <-> bottom.

bounds: mini_arcade_core.spaces.geometry.bounds.Bounds2D
apply(obj: RectSprite | LegacyRectSprite) None[source]

Apply vertical wrap to the given object.