So basically all I am trying to achieve here is very simple. Load up the game with the menu screen. Click the play button, moves to a "play screen", character dies, "home button" clicked goes back to the menu screen. However, when I try to click on the "play button" after my character dies, it does not seem to register the clicks at all. Bear in mind that on the first attempt (when the app is first opened) my buttons in the main menu class are clickable. However after i try to transition back into the same main menu class using the method updateGOSButtons() as shown below, the buttons become unclickable.
MENU SCREEN CLASS
public void show() {
//init table and stuff
buttonPlay.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
buttonClicked.play();
game.setScreen(new GameScreen(game));
dispose();
}
});
buttonRate.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
buttonClicked.play();
System.out.println("Nothing happens Yet");
}
});
Gdx.input.setInputProcessor(stage);
}
PLAY SCREEN CLASS
public void updateGOSButtons() {
if (gos.isGoButtonClicked()) {
gameOver.stop();
backgroundMusic.play();
gameState = GameState.START;
dispose();
game.setScreen(new GameScreen(game));
}
if (gos.isHomeButtonClicked()) {
gameOver.stop();
backgroundMusic.play();
gameState = GameState.START;
dispose();
game.setScreen(new MainMenuScreen(game));
}
Gdx.input.setInputProcessor(gos.getStage());
}