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 2c: Game Frames and Actions

You’ll hear frames per second frequently when talking about games. In this game you get to set what happens each frame and how often each frame is called. Look at the timer instance variable,  the “delay” argument says how much time to delay between frames. This timer sends a message to its listener, which in this case is “this”, referring to this class (MainClass). actionPerformed() gets called every time that the timer goes off, so this is where you add your code to check what happens every frame.

Complete actionperformed() by calling the necessary methods from part 2b. As a tip, you’ll want to have much of your logic in this method. You don’t want to be redrawing and growing the snake in KeyPressed, it makes this harder to handle. This method should be used to call redrawSnake(), growSnake() and any other necessary methods you create.

This is where the magic happens in your game. You may modify how the game “works” here.