put BoxMan to climb

Hi,

i cannot seem to give BoxMan greater powers to climb up on a platform with larger angel. I tried to put a friction to 1 but that didn't help.

Any ideas?
Can you supply an illustration? I'm having trouble visualizing what you are talking about. Thanks
Hi,

here is the illustration.
That picture helps a lot to understand your problem better, 🙂.

What I would do is create a special object that extends ShapeBase or perhaps just a special property on ShapeBase (false by default) that denotes a "climbingShape". When you listen for your contact events with your Hero, and the object he hits is a "climbingShape" then you can set a state or a variable you need to define in your Hero that says he is climbing. For example, when he hits a climbingShape, you set a boolean called "isClimbing = true" when he stops colliding with that shape (ContactEvent.END_CONTACT), you set isClimbing = false.

Now, how do you use this variable. In parseInput, you will check that if you are pressing left or right AND you are climbing, you need to apply extra force on your applyImpulse for the movement.

If you want an example of how I've used this, check out the game I just finished. The first level you'll play is a tutorial and you will come up to a box. That box has a special flag marked true on it called canPush. Anything that the player touches from the sides and is facing that is canPush will cause the player to switch animations and apply extra force when "pushing" the box. It's very effective, as I think you can see.

Original thread: https://box2d.org/forum/viewtopic.php?t=6859