I recently played through the new Streets of Rage—coincidence or not, the game has a level in a policy department where the player needs to handle the violent cops.
This game made me remember several of the Beat ‘em up games I used to play as a kid. They have a simple and rewarding game loop that I wanted to try prototyping.
Following the original games, the characters can move in any direction, but they only face and attack left or right. So, the attacks only happen on the horizontal axis. This kind of game has the player handling large crowds of enemies. To ballance for that, the attack area of the player is a large box in front of him, while the hit trigger of the enemies is just a sphere in their fists.
For the player, I implemented a simple combo of left punch, right punch, and a kick. It gets triggered as the player keeps pressing the attack button on the right time window.
The hardest thing in this prototype ended up being how to handle the different states of the characters and their transitions. They needed to be done in a way that the code didn’t become a big mess of if and else’s and at the same time without going too deep in new abstractions (the less code to do something, the better).