I’m trying to switch to another screen when the space key is pressed. Here is what my main game would look like.
I’m trying to switch to another screen via spacebar. For some reason, when I call the dispose method, it doesn’t do anything. My music is looped when I call play once. I’m not sure if things are disposed and It appears you need Scene2D to do any screen transition. Is there a simpler way?
public void create () {
//name of my first screen
this.setScreen(new Title(this));
}
@Override
public void render () {
super.render();
}
public void dispose () {
super.dispose();
}
In the title screen whenever it updates it does this.
if (Gdx.input.isKeyPressed(Keys.SPACE)) {
//hide method disposes things which doesn't work. Nature is never paused and loops
hide();
Nature.pause();
hos.setScreen(new mainGame(hos));
}
My first screen class: http://pastebin.java-gaming.org/371717b4e0913