Menu music/sounds

This commit is contained in:
Matt Low 2020-01-07 14:56:10 +04:00
parent 982e4ea5ad
commit c0c0a86a4c

View File

@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.me.pacman.PacDude; import com.me.pacman.PacDude;
import com.me.pacman.Sound;
public class MenuState extends LevelState { public class MenuState extends LevelState {
@ -41,6 +42,8 @@ public class MenuState extends LevelState {
font = game.assets.getFont(); font = game.assets.getFont();
Gdx.input.setInputProcessor(this.new Controller()); Gdx.input.setInputProcessor(this.new Controller());
game.sound.play(Sound.Effect.BEGINNING);
} }
@Override @Override
@ -65,9 +68,11 @@ public class MenuState extends LevelState {
switch (keycode) { switch (keycode) {
case Input.Keys.UP: case Input.Keys.UP:
selectedOption = selectedOption > 0 ? --selectedOption : options.length - 1; selectedOption = selectedOption > 0 ? --selectedOption : options.length - 1;
game.sound.play(Sound.Effect.CHOMP_1);
break; break;
case Input.Keys.DOWN: case Input.Keys.DOWN:
selectedOption = selectedOption < options.length - 1 ? ++selectedOption : 0; selectedOption = selectedOption < options.length - 1 ? ++selectedOption : 0;
game.sound.play(Sound.Effect.CHOMP_2);
break; break;
case Input.Keys.ENTER: case Input.Keys.ENTER:
switch (selectedOption) { switch (selectedOption) {