Seems like my game state is being initialized even though I have it commented out in the initStatesList(…) is there a reason for that? I have it initializing network code would that affect the initializing?
the exact error im getting is:
[quote]Unable to get I/O connection to: localhost on port: 1967
Exception in thread “main” java.lang.NullPointerException
at GameplayState.init(GameplayState.java:136)
at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
at CodaClient.main(CodaClient.java:33)
[/quote]
but the only connection attempt to localhost is in the game state
Heres my initStatesList:
public void initStatesList(GameContainer gameContainer) throws SlickException {
this.getState(MAINMENUSTATE).init(gameContainer, this);
//this.getState(GAMEPLAYSTATE).init(gameContainer, this);
this.getState(VICTORYSTATE).init(gameContainer, this);
this.getState(OPTIONSSTATE).init(gameContainer, this);
}
and the states added to the state list:
super("Title");
this.addState(new MainMenuState(MAINMENUSTATE));
this.addState(new GameplayState(GAMEPLAYSTATE));
this.addState(new VictoryState(VICTORYSTATE));
this.addState(new OptionsState(OPTIONSSTATE));
this.enterState(MAINMENUSTATE);
Complete Source Code:
CodaClient.java: http://pastebin.com/SvGnbVXr
MainMenuState.java: http://pastebin.com/W8bBDbn6
GameplayState.java: http://pastebin.com/rXm0kkik
OptionsState.java: http://pastebin.com/wStTBq0L
VictoryState.java: http://pastebin.com/gvUpGJf9
Based on slickBox Tutorial: http://slick.cokeandcode.com/wiki/doku.php?id=02_-_slickblocks
Edit: couldn’t get the JGO files to work so I just used pastebin