7 years ago by Xander
I wanted to get some input on this.
I have a Player who jumps and collides with 2 other fixed entities which are the same size, next to one another right above the Player. What I expect to happen would be for both of the other entities to have their check functions triggered, so that I can execute code for each. But that's not what happens.
Instead, because the dynamic collisions are resolved one at a time depending on the entity order creation (or zIndex order), the collision with the first entity gets resolved on the Y axis (that triggers the check function just fine), but now, the Player is no longer colliding with the second fixed entity and the its check function doesn't get fired.
Even if I jump the character again, it always hits the same fixed entity, sicne the order of the collision resolution is unchanged.
As a sort of work around, right now I have the fixed entity change its zIndex value after the collision, so that the next time the player collides with the two entities, the other fixed entities check function gets triggered this time.
But what I want to know is if there is a way to fire both check functions for each fixed entity in the same frame. It seems like I'll have to change the game class in some way to accomplish this. Like I need to check for all dynamic collisions first before resolving them. I'm curious what implications this might have on the functionality of dynamic collisions overall. Maybe doing this will have some unintended consequences?
Any help you could offer would be great, thanks!
I have a Player who jumps and collides with 2 other fixed entities which are the same size, next to one another right above the Player. What I expect to happen would be for both of the other entities to have their check functions triggered, so that I can execute code for each. But that's not what happens.
Instead, because the dynamic collisions are resolved one at a time depending on the entity order creation (or zIndex order), the collision with the first entity gets resolved on the Y axis (that triggers the check function just fine), but now, the Player is no longer colliding with the second fixed entity and the its check function doesn't get fired.
Even if I jump the character again, it always hits the same fixed entity, sicne the order of the collision resolution is unchanged.
As a sort of work around, right now I have the fixed entity change its zIndex value after the collision, so that the next time the player collides with the two entities, the other fixed entities check function gets triggered this time.
But what I want to know is if there is a way to fire both check functions for each fixed entity in the same frame. It seems like I'll have to change the game class in some way to accomplish this. Like I need to check for all dynamic collisions first before resolving them. I'm curious what implications this might have on the functionality of dynamic collisions overall. Maybe doing this will have some unintended consequences?
Any help you could offer would be great, thanks!