ConcaveCollider

class pygame_colliders.ConcaveCollider(points: List[Tuple[float]], data: Any = None)[source]

Creates new concave collider from given list of tuples.

Example of usage:

collider_points = [(3, 3), (5, 3), (5, 4), (4, 4), (4, 5), (5, 5), (5, 6), (3, 6)]
collider = ConcaveCollider(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
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])[source]

Check if point is within collider.

Warning

Not implemented. Returns currently always False

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