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¶
Legacy contract for something that can bounce. |
|
New contract for something that can bounce. |
|
Bounce an object off the top/bottom bounds by inverting vertical velocity |
|
Legacy contract for something that can wrap. |
|
New contract for something that can wrap. |
|
Wrap an object top <-> bottom. |
Module Contents¶
- class mini_arcade_core.spaces.d2.boundaries2d.LegacyRectKinematic¶
Bases:
ProtocolLegacy contract for something that can bounce.
- class mini_arcade_core.spaces.d2.boundaries2d.RectKinematic[source]¶
Bases:
ProtocolNew contract for something that can bounce.
Note: - In the current engine usage, transform.center is treated as top-left.
- 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.
- apply(obj: RectKinematic | LegacyRectKinematic) bool[source]¶
Apply vertical bounce to the given object.
- class mini_arcade_core.spaces.d2.boundaries2d.LegacyRectSprite[source]¶
Bases:
ProtocolLegacy contract for something that can wrap.
- class mini_arcade_core.spaces.d2.boundaries2d.RectSprite[source]¶
Bases:
ProtocolNew contract for something that can wrap.
- class mini_arcade_core.spaces.d2.boundaries2d.VerticalWrap[source]¶
Wrap an object top <-> bottom.
- apply(obj: RectSprite | LegacyRectSprite) None[source]¶
Apply vertical wrap to the given object.