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:
- 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.
- 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).
- Add a ball: add a ball that initially moves randomly, and bounces off the rackets and the side walls.
- Make the mechanics interesting: the direction of the ball should depend on the part of the racket it hit.
- Add some statistics information that counts the number of goals for each player and displays game information, such as the ball's current speed.
- Implement a simple AI player, so that one-player games are possible.
Here is a screenshot of what one implementation looks like: