Homework Assignment 2

Deadline: 7/3 (during/after class)
1. Pong.

For this exercise you have to construct a simple clone of the classic video game Pong. The required features are:

  1. Create a canvas with two rackets and a ball. Cool graphics are not needed, you can draw these with the canvas related javascript commmands we know.
  2. Read the keyboard: allow each of the paddles to be moved using appropriate keys. The paddles should be movable at the same time (for two-player play).
  3. Add a ball: add a ball that initially moves randomly, and bounces off the rackets and the side walls.
  4. Make the mechanics interesting: the direction of the ball should depend on the part of the racket it hit.
  5. Add some statistics information that counts the number of goals for each player and displays game information, such as the ball's current speed.
  6. Implement a simple AI player, so that one-player games are possible.
Here is a screenshot of what one implementation looks like: