ConvexCollider¶
-
class
pygame_colliders.ConvexCollider(points: List[Tuple[Union[float, int]]], data: Any = None)[source]¶ Creates new convex collider from given list of tuples.
Example of usage:
collider_points = [(11, 10), (11, 3), (4, 3), (4, 10)] collider = ConvexCollider(collider_points)
-
bottom¶ Bottom coordinate of bounding box.
Getter: the coordinate Setter: the new coordinate Type: float, int
-
bottomleft¶ Bottom left coordinate of bounding box.
Getter: the coordinate Setter: the new coordinates Type: tuple(float/int, float/int)
-
bottomright¶ Bottom right coordinate of bounding box.
Getter: the coordinate Setter: the new coordinates Type: tuple(float/int, float/int)
-
center¶ Center coordinate of bounding box.
Getter: the coordinates Setter: the new coordinates Type: tuple(float/int, float/int)
-
centerx¶ Center x coordinate of bounding box.
Getter: the coordinate Setter: the new coordinate Type: float, int
-
centery¶ Center y coordinate of bounding box.
Getter: the coordinate Setter: the new coordinate Type: float, int
-
collide(other) → bool[source]¶ Check collision against the other collider.
Parameters: other (Collider) – Other collider to check collision against. Returns: True if collision happens, False otherwise Return type: bool
-
data¶
-
h¶ Height of bounding box.
Getter: the height Type: float, int
-
height¶ Height of bounding box.
Getter: the height Type: float, int
-
is_clockwise¶ Checks if convex collider is clockwise.
Returns: True if clockwise, False otherwise Return type: bool
-
left¶ Left coordinate of bounding box.
Getter: the coordinate Setter: the new coordinate Type: float, int
-
midbottom¶ Center bottom coordinate of bounding box.
Getter: the coordinate Setter: the new coordinates Type: tuple(float/int, float/int)
-
midleft¶ Left center coordinate of bounding box.
Getter: the coordinate Setter: the new coordinates Type: tuple(float/int, float/int)
-
midright¶ Right center coordinate of bounding box.
Getter: the coordinate Setter: the new coordinates Type: tuple(float/int, float/int)
-
midtop¶ Center top coordinate of bounding box.
Getter: the coordinate Setter: the new coordinates Type: tuple(float/int, float/int)
-
point_collide(point: Tuple[float]) → bool[source]¶ Check if point is within collider.
Parameters: point (Tuple[float/int, float/int]) – Point to test Returns: True if point is collider, False otherwise Return type: bool
-
right¶ Right coordinate of bounding box.
Getter: the coordinate Setter: the new coordinate Type: float, int
-
size¶ Size of bounding box.
Getter: the size Type: tuple(float/int, float/int)
-
top¶ Top coordinate of bounding box.
Getter: the coordinate Setter: the new coordinate Type: float, int
-
topleft¶ Top left coordinate of bounding box.
Getter: the coordinate Setter: the new coordinates Type: tuple(float/int, float/int)
-
topright¶ Top right coordinate of bounding box.
Getter: the coordinate Setter: the new coordinates Type: tuple(float/int, float/int)
-
w¶ Width of bounding box.
Getter: the width Type: float, int
-
width¶ Width of bounding box.
Getter: the width Type: float, int
-
x¶ Left coordinate of bounding box.
Getter: the coordinate Setter: the new coordinate Type: float, int
-
y¶ Top coordinate of bounding box.
Getter: the coordinate Setter: the new coordinate Type: float, int
-