Peasant Knight Devlog 3

Posted on March 20, 2016

Yay! New stuff! Finally got to work on some new gameplay things. Also added new levels, for a grand total of 16.

Here are the portals in action:

I swear, there’s a way to beat this level. Also, not every level is this difficult. Portals were pretty easy to program, since they don’t affect any other systems in place. All they do is just a bit more complex than player.setPosition(this.x, this.y);.

Here’s the dumb orcs:

The dumb orcs were a lot more difficult to make. I had to refactor the PeasantKnight class into a Char class that PeasantKnight, DumbOrc, and other characters inherit from. Then I had to change the traps’ code so that they perform checks on all the characters instead of only the player. This way the traps can be triggered by and affect any character, which allows, for example, the dumb orcs to grill on a flame pit in the same way the player can. The PeasantKnight class was also becoming spaghetti code, with things like if (!dead && !jumping && !teleporting) so I got rid of all these flags and made an FSM instead. It’s much more manageable. The DumbOrc’s AI is also an FSM, but that’s nearly overkill since his behaviour is so simple.

New trap concepts, coming soon:

  • Run direction changer (credits to Gargoyle440 for the idea): it’s evil and I love it
  • Thumper: Goes up and down at fixed intervals, crushes the player
  • Horizontal moving platform: The game had vertical moving platforms since like day 1, don’t know why it took me so long to think of the other kind
  • Jump pad: I love jump pads in general, the soaring in the air feeling is awesome