Skip to main content
GameDev.net gamedev.net
🔒 Locked

2d Colision question

Started by patroclus Jun 29, 2002 at 3:23 AM 1 replies 350+ views
Original Post
patroclus
patroclus
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
Rickmeister
Rickmeister
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
bubach
bubach
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..

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.