0

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

2 Answers2

0

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.

Community
  • 1
  • 1
karlphillip
  • 89,883
  • 35
  • 240
  • 408
0

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

Paul Samsotha
  • 197,959
  • 33
  • 457
  • 689