Suggestions for character feet in 2D platformer
I'm currently making a 2D platform using C++ and OpenGL. I use OPAL for physics(it runs ODE, for those of you that aren't familiar with it). I have come to the point of implementing the player into the game. My problem is when the player comes to a hill. The player will be able to walk up a hill of atleast 45 degrees, possibly abit more. I have locked the player to always be straight-up. I am currently using a single 2D sprite for the player.
What would you recommend me to do?
The possible solutions that I have thought up:
Currently, the feet of the player is either sticking halway into the hill, or only the farthest out toe will have contact with the slope, the rest of the player just sitting there.
Having the player at a a right angle to the ground at all times would work, but would look really idiotic and be physically impossible on steep slopes.
I could create two seperate boxes that can rotate more freely than the player and but are attached to the bottom of the character. I would then use these positions for the feet.
I could also break the player into numerous more parts and basically treat it as a ragdoll and apply forces where needed. I'd like to avoid that, as animation could be rather difficult.
---------
On a side note, how would you recommend handling the walking animation while going up a slope?
Thanks in advanced!
Edit: after some more thought, is allowing the player to walk up 45+ degrees a good idea? You never do that in real life, and would have difficulty doing it even if you wanted to. Its very common to do this in a video game, though.
It is possible to walk up slopes with gradients of up to about 50°, although only just (and slowly). I know this from doing geological fieldwork and taking my clino to a particularly steep hill!
I would rotate the feet to match the landscape, and if it's a steep hill you may have to bend the knee and hip as well to make the joint angles look realistic. For the walking animation, just adjust the vertical position of the knee and ankle joints at each frame to compensate for the change in ground elevation.
I would rotate the feet to match the landscape, and if it's a steep hill you may have to bend the knee and hip as well to make the joint angles look realistic. For the walking animation, just adjust the vertical position of the knee and ankle joints at each frame to compensate for the change in ground elevation.
So you're suggesting to use multiple body parts put together instead of one sprite? I am currently using just a quad with a texture over it for the person. It would be a good programming exercise to do that, and could have pretty good results. I'll look into it.
And thanks for that interesting tidbit! I'm also geussing that it would be posssible to go up a steep hill very quickly too(ie: with a running start).
And thanks for that interesting tidbit! I'm also geussing that it would be posssible to go up a steep hill very quickly too(ie: with a running start).
This sounds like an art problem to me. You don't want to reorient the sprite to be paralell with the ground: that doesn't look right for bipeds. If you are able to determine when the user is going up a hill, I think the best solution would be to have a seperate walk animation: hunched over, hands on knees, etc. I think a decent artist should be able to make that look convincing on almost all the different inclines. And if not, you can always make sure all your inclines are the same. Most 2D platformers are like this.
Matt
Matt
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement