Build a Breakout Game
If children can build, play and understand games that work, it's possible that someday they will understand and design systems that work. And the world is full of complicated systems. —Sara Corbett
Back in the 1980s, video arcade games were in their prime. Local restaurants, pubs, and arcades lured customers with all of the latest titles: Pac-man, Galaxian, Donkey Kong, Tempest, Centipede, Defender, and more. (Un)fortunately, the rise of home video game systems and home computers relegated these gems to the back storage rooms of many establishments. They are not forgotten, however — even today, arcade cabinets are collected by enthusiasts and arcade ROM emulation systems such as MAME allow my generation to experience these relics first-hand on modern hardware (including, briefly, the iPad).
Breakout is a popular extension to the first cabinet arcade game, Pong, that was designed by Steve Jobs and Steve Wozniak, the founders of Apple, Inc. It was such a big hit that, to this day, it is still spawning additional game spin-offs in the form of the game Arkanoid. These games build on the basic premise of Breakout, clearing a field of bricks, but add elements of every other game imaginable. Here is a (long) video of the original gameplay and here is playlist of dozens of variants of the original game. If you are having trouble seeing implementing this game as a challenge, here are several specific variants that may get you thinking:
- Circus: the paddle is a seesaw for performers to jump up and pop balloons, with different jumps based on where on the seesaw you land
- Vortex: originally for the iPod, puts the blocks in the middle of the screen with the paddle moving around the outside (like a scrollwheel :)
- Worms: contains an incredible variety of possible power-ups that fall from bricks when they are hit
- Centipong: the moving centipede is the blocks and when they are hit it generates more balls
- PowBall: as the levels increase, it incorporates other video games as the blocks, like asteroids
- Pinball Breakout: this is just one of the many attempts to combine Pinball and Breakout style games
- Devilish: a scrolling version of the game, where clearing the blocks just opens up the passage allowing you to the fly through
- Warlords: a multi-player version, where each paddle protects its own castle from other players
Specifications
Write a Java program to play a 2D game of Breakout, in which a ball bounces around the screen and destroys blocks as it bounces into them. The player controls a paddle to block the ball from moving off the screen. The ball may bounce off of some sides of the screen; however, if the ball moves off a specific area of the screen (typically the bottom), the player loses a life and the ball is reset to its starting position. If the player misses blocking the ball too many times, the game should end and display a message that the player lost. If all the blocks are cleared from the screen, the level should end and a new one loaded (with a different configuration of blocks). If the player clears all the levels, the game ends with a message that declares the player won.
It does not need to be the greatest variant created, or even have sophisticated graphics, but it does have to meet a few basic requirements:
- Levels. At least three different levels, each of which has a different starting configuration of blocks. The configuration of blocks must either be determined algorithmically or read from a file, but it cannot simply be a sequence of specific position statements in your code, one per block. Additionally, the game should get harder in some way the more levels you survive. For example, increasing the ball's speed, decreasing the paddle's size, or placing the blocks closer to the bottom.
- Blocks. At least three different kinds of blocks. The typical block is cleared after one hit, but some blocks may take multiple hits, may give out power-ups, or may be worth extra points or whatever else you dream up for them to do. Of course, if some blocks are permanent features, they should not be counted when deciding to end the level.
- Paddle. Give the paddle at least three different abilities. These can be activated/deactivated in any way you want: per level, per power-up, per score, etc. Some common paddle abilities include making the ball bounce differently depending on where it hits (i.e., the middle third cause the ball to bounce normally, the left and right thirds cause the ball to bounce back in the direction it came), "catching" the ball when it hits the paddle and releasing it at a later time when a key is pressed, speeding up the longer it moves in the same direction, or warping from one side of the screen to the other when it reaches the edge.
- Power-ups. At least three different kinds of power-ups. Some blocks drop power-ups when they are destroyed which, when caught by the player's paddle, affect the game in various ways: making the paddle longer, speeding up the ball, giving the player extra bouncing balls to use to clear blocks, giving the player lasers with which to destroy blocks, giving the player a way to escape the level, or almost anything else you can think of.
- Status display. Display indicators that show (at least) how many lives the player has remaining, a score, and which level the player is on.
- Splash screen. It explains the rules of the game at start up. It should stay visible until the user clicks or presses a key to signal they are ready to start the game.
- Cheat keys. In addition to the player controls, it is useful to include documented cheat keys to help you debug your game and the course staff to play it :) For example, when the player presses a numeric key (i.e., 1-9), clear the current level and jump to the level corresponding to the number pressed, when the player presses the 'L' key, add additional lives to the player, or when the player presses the 'R' key, resets the ball and paddle to their starting position. Here are tons of ideas for cheat codes!
- Something Extra. Once you have the basic game working, add at least one substantial "extra" feature to make your game more interesting. It can be directly from one of the example variants above or something you make up.
You will use JavaFX as a starting point for building your game. You are welcome to look at the tutorial below or any other ones you find online, but your game should be distinctly different from any given examples you find (i.e., create a Breakout game, do not simply copy one). While some basic code will be discussed in class, it is expected you will learn most of the details by reading online examples and documentation.
Project Goals
This project is intended as a warm-up to get you started coding a project from scratch: so you can determine if the course is at the right level for your abilities and so we can determine a baseline for your sense of design. It is also intended to introduce you to using the JavaFX software since we will use it throughout the semester.
Deliverables
You will submit this project in stages to introduce you to the course's basic workflow.- Sprint 1: prepare for and plan your work for the project
- Sprint 2: implement your plan
- Sprint 3: reflect on your experience
Resources
- What is a Game Loop? by PotHix
- Getting Started with JavaFX
- Building a JavaFX Game: Part 1, Part 2, Part 3, and Part 4