1
\$\begingroup\$

I'm working in SDL and have bounding rectangles for collisions set up for each frame of the sprite's animation. However, I recently stumbled upon the issue of putting together collisions for characters walking up and down hills/slopes with irregularly curved or rocky terrain - what's a good way to do collisions for that type of situation? Per-pixel? Loading up the points of the incline and doing player-line collision checking? Should I use bounding rectangles in general or circle collision detection?

\$\endgroup\$
  • \$\begingroup\$ What is your problem specifically? Is it the collision detection or response? Try to be a little more specific. \$\endgroup\$ – dsilva.vinicius Sep 26 '13 at 23:19
1
\$\begingroup\$

You should read this guide Implementing Slopes

It is quite detailed and even though I haven't programmed slopes yet it has a lot of useful information and tell you not only ways of doing it, but you'll also find out how they were made on games you know well, so that's always a plus :)

\$\endgroup\$
0
\$\begingroup\$

If you want to apply real physics, you have to use physical engine. You can make your own physical engine but it implies a huge physical and programming knowledge. I would recommend you to use Box2D which is a good 2D physical engine written in C++. There are lot of tutorials about Box2D from which you can learn it easy and quickly. Here is also the official manual for it.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.