• Advertisement

Archived

This topic is now archived and is closed to further replies.

2d Colision question

This topic is 5357 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I read a lot of times that many (if not all) 2d collision detection routines store, before moving the sprite, his old position. I read this is to know the collision direction. I''m writing my own routine and I don''t store the last postion. If It collides with a platform or wall, it stops just touching it. My sprites do move more than one pixel per frame. Should I store the old position? What other functions does it have? Why do I need to know the collision direction in a platforms-game (like Mario)? Thanks

Share this post


Link to post
Share on other sites
Advertisement
If you store the sprite''s old position you can simplify the calculation of the angle of the sprite direction when it for example hits a wall and bounces away or wich way the sprite will head when hit by another ibject, like a bullet...

You can do without it, this is just one of the ways.. Pick one you prefer and stick with it I guess

God speed

Share this post


Link to post
Share on other sites
It can be good to know witch direction the sprite colided from when you for example can jump on a monster to kill it but you die if you just walk into it.
Then you will need to know if the collision was from the left or if it was from the top..

Share this post


Link to post
Share on other sites

  • Advertisement