Menu Soundtrack Logic - UQdeco2800/2022-studio-2 GitHub Wiki
Background Sound
Define menu background music
private static final String backgroundMusic = "sounds/MenuSong-Overcast.mp3";
private static final String[] mainMenuMusic = {backgroundMusic};
Set the specific music, Volume and loop of playing music.
private void playMusic() {
Music music = ServiceLocator.getResourceService().getAsset(backgroundMusic, Music.class);
music.setLooping(true);
music.setVolume(0.3f);
music.play();
}
Clear music when exiting menu interface
public void dispose() {
ServiceLocator.getResourceService().getAsset(backgroundMusic, Music.class).stop();
}
Button Sound Effect
private Sound sound;
Set the specific sound effect Volume and Volume of sound effect playback
private void onStart() {
Sound sound = Gdx.audio.newSound(Gdx.files.internal("sounds/ButtonSoundtrack.wav"));
sound.play(1.0f);
logger.info("Start game");
game.setScreen(GdxGame.ScreenType.MAIN_GAME);
}
Author
- Zhenyu Ding, Li-Sung Ou
- GitHub: @7ayuu, @PeterOu8
- Discord: 7ayuu#3089, Secret Agent Randy Beans#6754
- Slack: Zhenyu Ding, Li-Sung Ou