Java Reference
In-Depth Information
FIGURE 11.3: Pieces of the Tetris game.
11.12 Lab
Modify the game Breakout by allowing the user to fire bullets. A bullet can be fired
by pressing the Space key on the keyboard. When a bullet hits a brick, the brick and the
bullet should both be destroyed. The bullet should be destroyed if it reaches the top of the
panel without hitting a brick. If the bullet hits the ball, then a life should be lost.
11.13 Project
Create a version of the Tetris game. Different shapes can fall from the top of the screen.
Allow the player to move the shapes using the arrow keys. Each shape should consist of four
blocks, where the possible shapes are shown in Figure 11.3. Pressing the key Space should
rotate the shape. Pressing the down key should move the shape down to its place. The
playing area should be 10 blocks wide and 40 blocks high. When a horizontal line becomes
full, the line should be removed from the screen. Feel free to create levels. For example, the
user can move to the next level after removing 10 lines. As the levels increase, the bricks
should drop faster. Create a way to score the performance of the player and display the
score in the top right corner of the screen outside the playing area. The game ends when
the playing area is full and a shape cannot drop from the top of the screen.
 
Search WWH ::




Custom Search