Pong!
If you don't know what Pong is, you need to stop what you are doing and play a few games over at PongGame.org. I'm serious. But please turn down the volume; the sound effects get real old real fast. After you have a decent understanding of how it works, I want you to modify your code from Paddleball to create a 2-player Pong game.
Some adjustments you'll have to make.
1. You need the paddle to be on the sides of the board not on the bottom. 2. You need two paddles--one on each side. 3. The screen is a rectangle and not a square. 4. There needs to be a way to keep score for each player up to ten points.
|
It often helps me to pull out a sheet of paper and figure out the basic structure of the code before I begin. After I understand the skeleton of how I want my program to look, I can flesh it out with the details on the computer.
Extensions:
-Preferably, the ball not only bounces off the paddle but changes both direction AND velocity based on the paddle's location and speed. Notice how when you hit the ball on the corner of the paddle, the ball takes a sharp angle and increases in speed?
Change the way your ball bounces off each of the paddles based on where the ball hits the paddle. [Hint: compare the center of the ball to the center of the paddle]
-As in any game, the score should be shown on the screen.
-The center of the board should be clearly marked (as in tennis and ping pong) with a vertical dotted line.
-You could try to mod out your Pong game like these people did.
-Try to create a 1-player version. This means you need to make a bot to play against. This is the ultimate extension! Think about how to create a systematic way to tell the computer when and how to move the paddle based on the location of the ball (no teleporting paddles).