Game AppStates

Hi.

I use this hierarchy of my classes:

Game class attach GameState which extends extends AbstractAppState with all methods and got line:
[java]playState.simpleInitApp();[/java]

in stateAttached method. PlayState class got all the code of the game. When i run project i get error: http://scr.hu/1trj/2s24r

Can upload src if need.

A) exceptions are next to useless without stack traces but especially NullPointerExceptions.

B) why have a game state that just (incorrectly) initializes the PlayState. Why not just attach the play state and do the work on its initiliaze()?

C) never ever ever ever ever EVER override stateAttached(). It’s not for normal users. It’s mostly for debugging purposes.

Something seems very strange about your setup. You probably need to explain more or provide some code.

why not just attach PlayState? Because i cant extends SimpleApplication and also AbstractAppState.

@Skatty said: why not just attach PlayState? Because i cant extends SimpleApplication and also AbstractAppState.

You shouldn’t be making both your Game state and Menu state separate applications. You should have one SimpleApplication and attach your Play state and Menu state when needed. You should only have one SimpleApplication, unless for some reason you do need more than one. Please explain what you are trying to do.

So Main Game class should extends SimpleApp ? And PlayState should be a AbstractAppState ?

I rebuilded some code and here it is:
Game.java: http://pastebin.com/x6XJ2Wda
PlayState.java: http://pastebin.com/jiU6hW5a

but get same error (dunno why)

Well, the error looks fine from here since we can’t see it.