Simple question on Slick2d states.

So, I need a way to detect if you’re leaving the state you’re in, because it’d be pointless to transfer the state through every method to the one that changes the state, since the method that does that would only need it one time out of the other functions it performs. (It’s the code that returns interaction with objects)

Anyway, how can I check this from the state? Thanks.

Override GameState.leave(GameContainer, StateBasedGame).

Alternatively, override BasicGameState with your own abstract state classes that handle entering/leaving exactly how you want it to.