Minigame Monday: Pong of War
Pong of war:
- The concept:
Seeing as I was working on a game for the Roguelike Monthly Jam, I went for a simpler minigame this time (That's also why I didn't get this post out earlier in the week, sorry about that. Expect a post about the game jam game soon!). I decided I could reuse some of the code from Break-in and make a pong game. The twist I decided on was that there would be a third paddle, in the center of the screen, that both players have control over. So if one player moves up, and the other down, it doesn't move, but if both hold up it moves up at twice the speed and so on. (Hence Pong of war; like tug of war, get it?)
- The challenge:
Ball physics and rough bouncing physics I could take from Break-in, but one thing I needed to add was the ability to change the angle of the ball. To do this, I took the location of the impact along the length of the paddle as a ratio, and then used that to adapt the speed accordingly. The AI for the other player simply follows the Y direction of the ball, so wasn't too hard to add. Adding the third paddle in the middle was also pretty simple; have a direction value for both players, then move it in the sum of the directions. Although the controls here are digital (moving or not moving), if you did have a graduated input you could still use this method to produce relative movement in the middle paddle.
- The result:
The result is the classic game of pong but with the third paddle in the middle. One other place where it might differ is win condition; because of the way the enemy AI works, to score you want to have as much vertical momentum on the ball as possible. Then the AI won't be able to keep up with the vertical speed of the ball, and you'll eventually score. To do this, you need to let the ball land on the edge of your paddle, as that gives it the greatest change in velocity.
I was quite happy with how the middle paddle felt; it really does feel like you're fighting your oppoment for control of it, and you can do all the nice little tricks like suddenly changing direction to try to bounce/dodge the ball. If I was to expand this game, the first thing I'd like to do would be to add local multiplayer. Other than that, it would be interesting if the speed of the ball increased slightly with every bounce, making it harder and harder to defend as the game goes on. The game can be found at https://reddragonmakesgames.itch.io/pong-of-war, and the code is on github.
Comments
Post a Comment