## Pong game

posted by: Ms. Martin 29 November 2010 No Comment

You all should now have a ball bouncing back and forth between two paddles.  I encourage you to try to complete the game on your own but do look here if you are getting stuck.  By the end of today, I expect you to have a simple game in which two players can each control a paddle and the ball goes back and forth, bouncing at an angle.

1. If you’re not sure what Pong is, check out this example.
2. Make the two paddles move up and down.  Use ‘when __ key pressed’ and ‘change y by __’
3. Make the ball start facing a random orientation.  You’ll need to use ‘point in direction __’ and a random number between 0 and 360.
4. Make the ball bounce when it hits an edge by using the ‘if on edge, bounce’ block.
5. When the ball hits a paddle, it should turn to face the opposite way it came.  To do this, you will need to add 180 degrees to the current direction.  Find the current direction in the motion section and addition in the operators section.

You should now have a mostly playable game!  Notice, though, that it’s not very fun — you always know exactly where the ball is going to go.  How could you make it more interesting?

• Add a random turn after every move.  For example, turn a random number of degrees between 0 and 10.
• Keep track of points for each player.  For example, make a thin colored bar on each side of the field and when either one is hit, subtract a point.
• Make the game speed up over time.  For example, increase the move amount by 1 every time a point is scored.
• Display a winning screen.  For example, when a player gets 5 points.  You will need to investigate broadcast.
(2 votes, average: 5.00 out of 5)