Archived

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

Mr Teatime

Question regarding collision detection in a 2D Platformer

Recommended Posts

A simple question regarding collision detection in a 2D platformer, when looking for collisions on platforms (other than the ground ), should you only check for these collisions whilst your player is in the process of jumping? Or should the collisions be detected every loop regardless? I have tried detecting the collisions only when my player is jumping, but have come into trouble with this as my player is only defined as jumping when he is on the upward part of his jump, when he is falling back down, he is regarded as falling and the jump is over. I adopted this method to try and apply general gravity. Should this be the case or should my player be regarded as jumping until he comes back down to the ground? It may seem that I had been drifting a bit off-topic with the 2nd question, but its pretty much fundamental to the collision detection with the platforms. Any help would be much appreciated, thanks. [edited by - Mr Teatime on May 1, 2003 6:24:29 PM]

Share this post


Link to post
Share on other sites
Why don''t you check collision when your player is either jumping or falling?

I''d make it check all the time, though. If you have some items or bullets flying around in your game, collision-test all the time will save your sweat.


Share this post


Link to post
Share on other sites
Thanks for the help.

I have changed it to check it when its falling and right now it suffices, but I had though of situations when maybe it would be possible to jump from a platform to platform over a short distance(upwards) and maybe the player wouldnt have reached the falling stage before the collision is supposed to happen.

Would this scenario ever occur?

Also, is this a good way to generalise gravity? To differentiate between your player falling and jumping, or should it just be the case that your player should be considered jumping until it hits the ground ( or another platform for that matter )?

[edited by - Mr Teatime on May 1, 2003 6:53:40 PM]

Share this post


Link to post
Share on other sites