Collidable
Trait providing collision detection capabilities for positioned and sized entities.
Combines position and size information to enable spatial collision detection, point containment checks, and geometric calculations. Uses axis-aligned bounding box (AABB) collision detection for efficient spatial queries.
Attributes
- Graph
-
- Supertypes
- Known subtypes
-
trait CollidableEntitytrait Gameclass BlackJackGameclass RouletteGameclass SlotMachineGameclass WallShow all
Members list
Value members
Concrete methods
Returns the bottom-left corner coordinates of this entity.
Returns the bottom-left corner coordinates of this entity.
Attributes
- Returns
-
the position vector representing the bottom-left corner
Returns the bottom-right corner coordinates of this entity.
Returns the bottom-right corner coordinates of this entity.
Attributes
- Returns
-
the position vector representing the bottom-right corner
Returns the center point of this entity's bounding rectangle.
Returns the center point of this entity's bounding rectangle.
Attributes
- Returns
-
the position vector representing the geometric center
Checks if this entity collides with another positioned entity.
Checks if this entity collides with another positioned entity.
Performs axis-aligned bounding box collision detection by checking for overlap on both horizontal and vertical axes. Both overlaps must be true for a collision to be detected.
Value parameters
- other
-
the other positioned entity to check collision against
Attributes
- Returns
-
true if the entities' bounding boxes overlap
Checks if a point is contained within this entity's bounds.
Checks if a point is contained within this entity's bounds.
Uses inclusive bounds checking on the left and top edges, and exclusive on the right and bottom edges to prevent edge overlap issues.
Value parameters
- point
-
the 2D point to test for containment
Attributes
- Returns
-
true if the point is within this entity's rectangular bounds
Returns the top-left corner coordinates of this entity.
Returns the top-left corner coordinates of this entity.
Attributes
- Returns
-
the position vector representing the top-left corner
Returns the top-right corner coordinates of this entity.
Returns the top-right corner coordinates of this entity.
Attributes
- Returns
-
the position vector representing the top-right corner