I created a game over window when the player loses and it looks nicely.
The problem is I’m trying to disable touch in all other actors in the group except the game over window but from some reason the touch in the window is also disabled along with all the other actors.
Here is a snippet of my code:
public void spawnGameOverWindow() {
GameOverView gameOver = new GameOverView(skinJson, this);
addActor(gameOver);
slideFromLeft(gameOver, new Vector2(0 - gameOver.getWidth(), Values.SCREEN_HEIGHT/2),
new Vector2(Values.SCREEN_WIDTH/2-gameOver.getWidth()/2, Values.SCREEN_HEIGHT/2 - gameOver.getHeight()/2),0.3f, false);
disableTouch(gameOver);
}
public void disableTouch(Actor exception) {
for(Actor actor : getChildren()) {
if(!(actor == exception))
actor.setTouchable(Touchable.disabled);
}
}
I debugged it a little and something is wrong with the if condition inside the for loop. I’m trying to check if actor and exception has the same reference to the same object( which is "gameOverWindow).
What’s wrong?