mini_arcade_core.spaces.d2.collision2d

2D collision detection helpers.

Classes

Collider2D

Abstract base class for 2D colliders.

RectCollider

OOP collision helper that wraps a Position2D + Size2D pair.

Module Contents

class mini_arcade_core.spaces.d2.collision2d.Collider2D[source]

Bases: abc.ABC

Abstract base class for 2D colliders.

position: mini_arcade_core.spaces.geometry.bounds.Position2D
size: mini_arcade_core.spaces.geometry.bounds.Size2D
abstractmethod intersects(other: Collider2D) bool[source]

Check if this collider intersects with another collider.

Parameters:

other (Collider2D) – The other collider to check against.

Returns:

True if the colliders intersect.

Return type:

bool

class mini_arcade_core.spaces.d2.collision2d.RectCollider[source]

Bases: Collider2D

OOP collision helper that wraps a Position2D + Size2D pair.

It does NOT own the data - it just points to them. If the entity moves (position changes), the collider “sees” it.

Variables:
  • (Position2D) (position) – Top-left position of the rectangle.

  • (Size2D) (size) – Size of the rectangle.

position: mini_arcade_core.spaces.geometry.bounds.Position2D
size: mini_arcade_core.spaces.geometry.bounds.Size2D
intersects(other: RectCollider) bool[source]

High-level OOP method to check collision with another collider.

;param other: The other rectangle collider. :type other: RectCollider

Returns:

True if the rectangles intersect.

Return type:

bool