Jump to content
  • Advertisement


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


2-D Collisions

This topic is 5523 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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!