CSC 213 — Programming Fundamentals

Lab 09 - Falling Shapes

Assignment

  1. Create a new GraphicsProgram with init and run methods. Create an empty game loop in run.

  2. Create an ArrayList of GObjects. The ArrayList should be a class variable, and should be initialized in the init method.

  3. Write the necessary code so that when the user types a key on the keyboard, a new shape is created and added to the ArrayList. If the user presses "c", it should create a circle, "s" a square, "r" a rectangle.

  4. The location, color, and size of the shape should be random.

  5. When a shape is created, it should be added to the ArrayList.

  6. After you get steps 1 - 5 working, modify the run() method so that every frame, each object in the ArrayList is moved down the canvas by a certain number of pixels.

BONUS:

Opportunities for bonus points include:

Hints

Submission

To submit your assignment, follow the instructions for code submission. Make sure you submit your entire project so that both Java files are included.