I have a problem that I can’t solve. Creeps are spawned by a method called in the main AppState and detach themself when they hit the player base. When the player have no more hp the game end. I thought of detaching the AppState: app.getStateManager().cleanup();
The screen goes black because all the Spatial are detached from rootNode, but the score keep going down, wich means the controlUpdate() method of the creeps continue being fire, as gameover() is.
Question would be why do you think what you do its correct in the first place? You just need to detach your AppStates (given they are written correctly which I don’t think when you try and call stateDetached, the stuff you have there is probably belonging into cleanup())
To put it more succinctly. Never call that method. And if you think “No, I really need to call that” then check again because you should NEVER call that method.
It is ONLY used internally. This is not one of my “advice unless you know better” situations. No one should ever call that method directly. It’s only supposed to be called when the application is shutting down… it effectively kills all registered app states. (In the future, this will be almost everything that JME does… akin to closing the application.)