Developing a Pong Game

posted by: Mr. Bergquist 12 February 2012 No Comment

NOTE: This will be our final program we will build together.  Please take the time to make this project your own.  If you are done early and signed off, you can start work our Final Careers Assignment in 3 Parts.

From the Scratch conditionals worksheet, 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.  First get a simple game in which two players can each control a paddle and the ball goes back and forth, bouncing at an angle. We will add more to this game in the next couple days.

  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.

After getting the simple game woking we will make the game more interesting!  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? We will cover variables and broadcast later, but you can investigate them yourself to help you try to add these features:

  • 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 (variables).  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.
Depending on time, we may forgo scoring this as a projects.  Typically you will build the full game to be graded with the Scratch Pong Game Project Rubric found here, 10 project points.
1 Star2 Stars3 Stars4 Stars5 Stars (9 votes, average: 3.67 out of 5)
Loading ... Loading ...

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>