Monday, January 30, 2017

From Pong to Racquetball, or Somewhere In-between

This is the continuing saga of my efforts to make my own Pong clone. I actually made a lot of changes to it since I last wrote about it, so I think what I’m going to do is simply make a bulleted list and then go from there. My first post, where I described my early progress, can be found here: http://bitsandpixelsdev.blogspot.com/2017/01/and-so-it-begins.html

Changes

  • Made the ball start in the middle of the screen and move in a random direction
  • Updated the textures used for the ball and walls
  • Added left and right player paddles
  • Added collision detection for the walls and paddles, so the paddles won’t move into the walls and the ball will bounce off of everything
At this point, I was pretty happy with things. I had something that worked! The ball moved and bounced, and player interaction was possible. I was especially proud of the fact that I was able to work out how to change the direction of the ball when it bounced off of something on my own. I know it’s a small detail, because it’s actually a really simple calculation for the new direction, but that was one of my goals with this whole project: see how much I could do on my own without looking for help.
However, I suddenly realized something. I had put in two paddles simply because I had the normal game of Pong in my mind, but I didn’t really have any intention of creating a two player game; at least not at that moment. And I didn’t want to try to create an AI for the second player either (more complexity, and all that). So I decided to remove the left paddle and put in a wall instead.
Easy. Except now I don’t have pong; I have racquetball instead. And that leads to something else: how do I handle scoring for racquetball? Points don’t make sense. So I think what I’m going to do is implement two game modes, just for fun. There will be racquetball with a timer, and the goal is to see how long you can hit the ball before it goes past your paddle, and then there will be proper two-player Pong with point scoring. In both cases, I’ll speed up the ball slightly every time it’s hit by a paddle. And maybe I’ll try to implement an AI in the future; I haven’t decided yet.
So, next steps...
  • detect when the ball leaves the window for scoring, and reset the ball back to the middle of the screen
  • add a second game mode for two-player pong proper, and a way to switch modes
  • add scoring for both game modes
  • oh, and change the color of that left wall :)
But for now, at least I have progress!

No comments:

Post a Comment