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 the Background

Here you will set up the game and all of its graphical components. You will be using a graphics library called, The ACM Java Libraries, which was developed at Stanford University. It was design to create simple user interfaces like this one. 

It’s important for you to understand the basics of this library. You need to be especially familiar with understanding that all games, and graphics programs, use a Canvas, just like a painter uses a canvas. You draw on the canvas, and the canvas is updated frequently, thus, creating the illusion that things are moving when the program is just redrawing objects in a different position at a very quick pace.

The documentation has many methods that you can use. Make sure to look at them closely. 

For this project, to create anything on the screen you can use either a GRect( rectangle) or a GOval (oval). A snake is made up of many GRect ojects. The ball is made up of one GOval object. The scoreboard and instructions are GLabels. You will add these to the canvas and update them as necessary.  

Watch the following tutorial that will show you how to use the Canvas, GRect, GOval and Glabel classes.

Background

Edit the run() method in MainClass, to set the background color. You can approach this in two ways, 1) create a GRect object that has the same width and height as the canvas, and then add the GRect object to the canvas using a color of your choosing, or 2) see below.

A bit simpler way is to use the setBackground(color) method which takes a color as the argument, and sets the canvas’ background to that color. Check the documentation for this method.