Skip to content

Conversation

@Mambouna
Copy link

Adds pixel perfect collision detection with masks between two actors as a new function:

actor1.collidemask(actor2)

Masks are only created when necessary and the collision check ends early if the rects of the actors don't intersect.

The documentation makes it very clear that this kind of collision check is a lot more expensive than .colliderect() and discourages general usage unless necessary.

Unittests are written.

Mambouna added 3 commits July 26, 2025 11:36
Adds `actor1.collidemask(actor2)` as a function to check pixel
perfect collisions.

The function first checks for collision via `.colliderect()` and
masks are only created for actors when necessary, meaning there
is no performance cost if the function isn't used in a project.

Adds documentation and tests. The documentation makes it clear
that this function has a bigger impact on performance than
`.colliderect()` and should only be used sparingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant