Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

How would I go about detecting the corners of a texture when I use pixel collision detection? I read about corner collision with rectangles, but I am unsure how to adapt it to my situation.

Right now my map is tile based and I do rectangular collision until the player is intersecting with a blocked tile, then I switch to pixel collision.

The effect I would like to achieve is when the player hits the corner of an object to push him around the side so he doesn't just hit the edge and stop.

Any ideas?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You should check several pixels ahead your sprite.

A exhaustive article about it (in Sonic games) is located here: http://info.sonicretro.org/Sonic_Physics_Guide?v=0

share|improve this answer
    
Checking the pixels ahead a bit to see if it transparent worked. I'm embarrassed I didn't think of something so obvious. Thank you :p –  Milkboat Apr 11 '12 at 22:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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