MyGame.java
package io.github.some_example_name;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
/**
* <code> MyGame </code> handles creating and presenting the game from
* the different screens.
* @see com.badlogic.gdx.Game Game
* @see com.badlogic.gdx.Screen Screen
*/
public class MyGame extends Game {
GameScreen gameScreen;
public static Music music;
boolean won = false;
public SettingsLogic settingsLogic = new SettingsLogic(0.5f);
@Override
public void create() {
gameScreen = new GameScreen(this);
setScreen(new MenuScreen(this));
music = Gdx.audio.newMusic(Gdx.files.internal("background_music.mp3"));
music.setLooping(true);
music.play();
}
public void restartGame() {
gameScreen = new GameScreen(this);
setScreen(gameScreen);
won = false;
}
public void goToGame() {
setScreen(gameScreen);
}
}