Write a game where the user can use the mouse to move a ball at the bottom of the screen. A path animates coming down the screen and if the ball hits a barrier the game ends.

One insight that we found very useful was that its easier to:

  • make the background black,
  • add white rectangles (the path)
  • make sure that all corners of the users ball was always colliding with something :).

In the examples above we created GRects way above the screen, put all of the rectangles into an ArrayList and then every frame moved all GRects in the array list down.

There are many other versions of a similar concept. In the example on the left we randomly created a path. In the example on the right the user should dodge randomly created dropping blocks