Walk, jump, climb and punch!


With buildings that can be destroyed we need someone to actually destroy them, right?


Character's prototype code was heavily refactored to allow the Ape -our only character yet- to walk, jump, climb and punch. But what does this involve?

  • Walking on the ground and on top of buildings.
  • Climbing up a building, if its side is not behind another one.
  • Once we reach the top, stop climbing and stand on the roof.
  • When standing on the roof of a building, being able to climb down or jump.
  • Jumping when the character is grounded.
  • Jumping when the character is climbing.
  • Landing on buildings.
  • Registering punches on pieces of buildings that are not behind another building.

Walking is easy, as long as there's a reliable way to know if the character is grounded. In Rampaging, grounded includes the ground (easy, it's flat, so that's just a y-coordinate check), but also buildings' roofs. That involves character's x position and building's x, width and height.

Jump is as basic as it gets: press a button and set a vertical velocity. Always the same velocity, because this is not a platformer, after all. And once we are in the air gravity kicks in and we fall until we are grounded again or we grab a building to climb.

Now climbing is the tricky action, because it involves both being grounded and climbing up if we are properly aligned with a building, but also being on a roof and climbing down. That red line in the image shows the pivot point I use to check if the character is aligned, which also depends on the direction we are facing. Once we climb up to the top of a building the character is forced to jump a bit, so it lands on the roof.

The character stores the building it's climbing or standing on, which makes some checks way easier (see, the grey building is highlighted). That way, climbing down only needs to check if we are close enough to the edge of a roof.  There's room for improvement here in relation to distances, but so far it works nicely.

Finally, punching basically requires checking on which building the punch lands and if the tile is actually visible. That way we can punch any building no matter if we are climbing, jumping or walking. Makes destruction easier!

I also added some particles here and there, some screen shacking if we land after a long fall, cracking buildings to warn they are about to collapse and three basic poses for walking, climbing and jumping/falling.

It almost looks like a game now! 

Time to start working on the army!

Get Rampaging

Buy Now$2.00 USD or more

Leave a comment

Log in with itch.io to leave a comment.