Homework Assignment 5 (JS project 2)
Mandatory part:
Deadline: 11/4 (during/after class)
1. Arkanoid.
For this exercise you are allowed (and expected) to re-use your code for Pong and for Paint.
The objective of this exercise is to construct a simple version of Arkanoid, the classical video game. Here, as in Pong, the player is given a racket and a ball, but there is no opponent. Instead, the playing area is filled with bricks. The bricks break when they are hit by the ball. The goal of the game is to break all the bricks, without letting the ball fall down
Requirements:
- You are required to write two separate programs. The first is the main Arkanoid game. This program will allow the user to play Arkanoid. Level information will be stored in XML files and loaded at the user's request.
- You must also program a level editor, which allows the user to prepare Arkanoid levels. The editor should produce XML files that the user can copy-paste, in a way similar to the paint program of the previous homework.
- For the main game: game play should be roughly similar to Pong, but with one player. The paddle is controlled with the arrow keys on the keyboard. The ball should change direction depending on which part of the paddle it hits (allowing the user to aim). Levels may consist of bricks, which must be broken with the ball, and walls which cannot be broken and simply deflect the ball when it hits them.
- Add a pause button to the game, and a counter for the number of lives the player has lost so far.
- Add a load button that lets the user load an XML file with level information.
- For the editor: the editor can be a simplified version of the paint program. The user can create walls or bricks in the same way that rectangles were created in Paint. He can change the color used, but not the thickness. It is not necessary to have an undo or a select function. The editor should be able to load XML files and to display (in real time) the XML file describing the level currently being made.
- The editor should also allow the user to change the size of the playing area.
XML format: For saving/loading level you are expected to use an XML format created for this exercise. The format is very simple: the basic tags are called <brick> and <wall>. They contain the attributes top,bottom,left,right describing the coordinates of a rectangular brick, or piece of wall, as well as a color attribute. The main tag is called <arkanoidlevel> and it includes two attributes, width,height, which determine the size of the playing area.
The easiest way to understand this format is through some examples. Here are some XML files created by the program demonstrated in class. Here are a few examples of XML files file1, file2.
Your program must be able to read the above files! Do not use your own XML format.
Screenshots: