Jump to content
  • Advertisement
Sign in to follow this  
Sivak

2-D platformer character - hitboxes to "roll" off walls when jumping?

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

This is something that's kind of hard to describe, but it's a behavior that I know some 2-D platforming games do with jumping characters. Take a look at the image below:

gimmick0.png - On the left is before he approaches a ceiling, and on the right we can see he's to the left of that solid block and in this game, he actually "rolls off" the edge of it. Basically he accelerates to the left a tiny bit for this "rolling" behavior.

My current game engine has a hit box that is simply 4 points for the character for all 4 corners. It naturally works, but for jumping it just assumes if either one of the 2 top points hit something solid, you stop jumping and hit your head.

When jumping, I look at either two or three possible points depending on the situation:
#1 - If you jump without moving horizontally, then it simply checks the top left and top right points. If either hit solid, you stop.
#2 - If you jump and ARE moving horizontally, (we'll use left for this example), it checks the points in this order: top right, bottom left, top left

Is there an easy way to change this behavior to be closer to what was shown with the image? Do I need more points for the top portion of the hitbox to do this?

Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!