Share this post

Link to post

Share on other sites

Most movement routines move the sprite to a NEW location and keep the OLD location, then check for collisions and only move if the there are no collisions. In this case (where you check for the NEW location collision) it is always the initiator of the move that caused the collision because at that point in time nothing else is moving.

How does your movement code work?

If you just move the position of the sprite and then check for collisions I'd suggest changing to the above method.

Share this post

Link to post

Share on other sites

Original post by D3DXVECTOR3Well the collsion detection works by checking if the sprites are on top of eachother. It needs to be like this: If there is collsion check who slammed into who

It depends on what you mean by "who slammed into who". What does it mean in terms of gameplay? (What difference does it make?) If it's for physics simulation, for example, to chenge the speeds, then you don't really need to know who bumped into whom, because you can just use the difference of the pre-bump speeds to calculate new velocities. If it's some other game mechanic, then I imagine the particulars would determine your testing procedure.