Adding Game States
In the Engine class...
// These integer constants store the codes for each state.
public static final int TITLE_ID = 0;
public static final int GAME_ID = 1;
// We declare a BasicGameState for each state
private BasicGameState title;
private BasicGameState game;
// In our constructor we initialize the game states with a code.
public Engine(String name)
title = new Title(TITLE_ID);
game = new Game(GAME ID);
// Add states to our list. The first state we add is the starting state.
void initStatesList(GameContainer gc) throws SlickException
Adding the Title Class
If you're working with the Template... your program will probably have an error at this point.
It knows about the main gameplay state, but it doesn't know about title.
You'll need to add a "Title" game state to your project
To do so, click in the package explorer. Copy and Paste "Game.java" and name it "Title.java."