Archived

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

2-D Collisions

This topic is 5240 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''m making a simple 2-D sidescroller (gotta start somewhere, right?) and I was wondering how to make a good complex collision detection system. I''m able to make a tile-based level where everything solid is a box, like in Super Mario Bros., but I can''t figure out a good, efficient way to make the player able to, say, walk up a ramp. My focus for this question is environmental collisions, but any general collision techniques would be welcomed. Thank you in advance.

Share this post


Link to post
Share on other sites
if(player.y < player.x * block.slope + block.height_offset)
player.y = player.x * block.slope + block.height_offset;

If you''ve gotten anywhere in math you should know what slope is. Time to put all that stuff you though was useless to work for you.

Share this post


Link to post
Share on other sites