-
-
Notifications
You must be signed in to change notification settings - Fork 900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add listener for when collision detection has been completed #2849
Comments
Doesn't |
|
I've updated the description and title to cover what we have discussed on discord. |
Add a new variable to the `CollisionDetection` class. Call `notifyListeners` at the end of the collision detection step, so that users can add a listener to their code to know when this step has finished. The variable is a basic implementation of a `Listenable` class, since it needs no more complexity. Closes #2849
Problem to solve
In certain situations one needs to know the order in which collisions happened (during a time step). For instance if a player collides with both an enemy and the goal within the same time step. To achieve this, one can assemble a list of objects that are passed to the multiple calls to
onCollision
. By creating an additional callbackonCollisionsCompleted
which is called once all the calls toonCollision
are finished, then the player has a full list of all the objects with which it collided within the time step.Proposal
Following discussion on discord, this can be achieved by adding a
Listenable
object to theCollisionDetection
class.More information
I've started working on a branch for this: https://github.com/christian-mindfulness/flame/tree/add_collision_completed
The text was updated successfully, but these errors were encountered: