EDIT: I FIXED IT MYSELF. At the end if both classes, I typed
Return 0;
Menu should be 0 and Play should be 1 so I fixed it
EDIT: I FIXED IT MYSELF. At the end if both classes, I typed
Return 0;
Menu should be 0 and Play should be 1 so I fixed it
The problem happens at javagame.Game.initStatesList(Game.java:19). I don't know which line that is from your code, but NullPointerException happens when you try to access members of a reference variable that wasn't previously allocated.
You're passing gc to your init method:
this.getState(menu).init(gc, this);
this.getState(play).init(gc, this);
But in your init methods, you don't do anything with them
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException{
}
You may want to instantiate them in the method