mini_arcade_core.spaces.d2.collision2d ====================================== .. py:module:: mini_arcade_core.spaces.d2.collision2d .. autoapi-nested-parse:: 2D collision detection helpers. Classes ------- .. autoapisummary:: mini_arcade_core.spaces.d2.collision2d.Collider2D mini_arcade_core.spaces.d2.collision2d.RectCollider Module Contents --------------- .. py:class:: Collider2D Bases: :py:obj:`abc.ABC` Abstract base class for 2D colliders. .. py:attribute:: position :type: mini_arcade_core.spaces.geometry.bounds.Position2D .. py:attribute:: size :type: mini_arcade_core.spaces.geometry.bounds.Size2D .. py:method:: intersects(other: Collider2D) -> bool :abstractmethod: Check if this collider intersects with another collider. :param other: The other collider to check against. :type other: Collider2D :return: True if the colliders intersect. :rtype: bool .. py:class:: RectCollider Bases: :py:obj:`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. :ivar position (Position2D): Top-left position of the rectangle. :ivar size (Size2D): Size of the rectangle. .. py:attribute:: position :type: mini_arcade_core.spaces.geometry.bounds.Position2D .. py:attribute:: size :type: mini_arcade_core.spaces.geometry.bounds.Size2D .. py:method:: intersects(other: RectCollider) -> bool High-level OOP method to check collision with another collider. ;param other: The other rectangle collider. :type other: RectCollider :return: True if the rectangles intersect. :rtype: bool