This forum is read only and just serves as an archive. If you have any questions, please post them on

6 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!

6 years ago by Joncom

Are you trying to create a situation like in Mario (NES), where he jumps upward and hits between two brick blocks, breaking them both simultaneously?

Maybe you could have the player continue to checkAgainst the blocks, but set the player collides to ig.Entity.COLLIDES.NEVER. This would prevent premature collision resolving.

Then, each frame, you could use the player check function to push to some array the blocks he collides with.

Then, in your main.js update function, after this.parent() (meaning checks will have finished), set player .collides to ig.Entity.COLLIDES.LITE or something, and call ig.Entity.solveCollision for each block/player collision you detected.

Then, set .collides back to NEVER, and clear the blocks array so you can repeat this process on future frames.

6 years ago by Xander

Very interesting idea! Yes, it's for mario style blocks.

Trying the changes you suggest will mean I'll have to change how the Player class interacts with all the other entities I've made so far. But it might be a necessary change to make, we shall see.

Thanks for the reply!

6 years ago by vickidcasey

so have you dealed with it ?
Page 1 of 1
« first « previous next › last »