Topic 1 - Variables and Data Types
Topic 2 - Conditionals and Strings
Topic 3 - Loops
Topic 4 - Arrays
Topic 5 - File Handling
Semester 1 Projects
Topic 6 - Classes/Objects and Methods
Topic 7 - ArrayLists
Semester Projects

Part 1a: Set Up Bricks

Before you start playing the game, you have to set up the various pieces. Thus, it probably makes sense to implement the run method as two method calls: one that sets up the game and one that plays it. An important part of the setup consists of creating the rows of bricks at the top of the game, which looks like this:

Yours can use different colors, but it should have 10 rows and 10 columns.

The number, dimensions, and spacing of the bricks are specified using named constants in the starter file, as is the distance from the top of the window to the first line of bricks. The only value you need to compute is the x coordinate of the first column, which should be chosen so that the bricks are centered in the window, with the leftover space divided equally on the left and right sides. The color of the bricks remain constant for two rows and run in the following rainbow-like sequence: RED, ORANGE, YELLOW, GREEN, CYAN.

Create a setUpBricks() method that creates each GRect, places it at the correct coordinate and adds it to the canvas .

This method should be called in run().

You run() method can be thought of as main(). You’ll want to tackle each of the following sections as a separate problem and use the appropriate methods in run() individually.

Watch the following video for a run-down of how to use the graphics library and use the methods in run().