Coverage Summary for Class: GameOverInputHandler (com.mozarellabytes.kroy.Utilities)
Class | Class, % | Method, % | Line, % |
---|---|---|---|
GameOverInputHandler | 0% (0/ 1) | 0% (0/ 9) | 0% (0/ 14) |
1 package com.mozarellabytes.kroy.Utilities;
2
3 import com.badlogic.gdx.Input;
4 import com.badlogic.gdx.InputProcessor;
5 import com.mozarellabytes.kroy.Kroy;
6 import com.mozarellabytes.kroy.Screens.MenuScreen;
7
8 /** This class controls the input for the game over screen, it
9 * is used when the game over screen is displayed and the player
10 * has to press a button to return to the main screen.
11 */
12
13 public class GameOverInputHandler implements InputProcessor {
14
15 private final Kroy game;
16
17 /** Constructs the GameOverInputHandler
18 * @param game needs the game to be able to return to the menu screen */
19 public GameOverInputHandler(Kroy game) {
20 this.game = game;
21 }
22
23 @Override
24 public boolean keyDown(int keycode) {
25 return false;
26 }
27
28 @Override
29 public boolean keyUp(int keycode) {
30 if (keycode == Input.Keys.A) {
31 SoundFX.sfx_truck_attack.stop();
32 }
33 return false;
34 }
35
36 @Override
37 public boolean keyTyped(char character) {
38 return false;
39 }
40
41 @Override
42 public boolean touchDown(int screenX, int screenY, int pointer, int button) {
43 return false;
44 }
45
46 /** Stops the game music from playing and returns to the menu screen
47 *
48 * @param pointer the pointer for the event.
49 * @param button the button
50 * @return whether the input was processed */
51 @Override
52 public boolean touchUp(int screenX, int screenY, int pointer, int button) {
53 SoundFX.stopMusic();
54 game.setScreen(new MenuScreen(game));
55 return true;
56 }
57
58 @Override
59 public boolean touchDragged(int screenX, int screenY, int pointer) {
60 return false;
61 }
62
63 @Override
64 public boolean mouseMoved(int screenX, int screenY) {
65 return false;
66 }
67
68 @Override
69 public boolean scrolled(int amount) {
70 return false;
71 }
72 }