Skip to content

Commit

Permalink
Added quit on escape
Browse files Browse the repository at this point in the history
  • Loading branch information
srikavin committed Jan 8, 2020
1 parent 49903d6 commit 4a8f289
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ TODO
| Move Up | *Up Arrow* |
| Move Down | *Down Arrow* |
| Move Right | *Right Arrow* |
| Use Item | *E* |
| Quit Game | *Escape* |

## Run Instructions

Expand Down
6 changes: 4 additions & 2 deletions core/src/me/srikavin/fbla/game/KeyBindings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ enum class Actions {
MOVE_LEFT,
MOVE_RIGHT,
JUMP,
USE
USE,
QUIT
}

class KeyBindings(val bindings: Map<Actions, Int>) {
Expand All @@ -15,7 +16,8 @@ class KeyBindings(val bindings: Map<Actions, Int>) {
Pair(Actions.MOVE_LEFT, Input.Keys.LEFT),
Pair(Actions.MOVE_RIGHT, Input.Keys.RIGHT),
Pair(Actions.JUMP, Input.Keys.UP),
Pair(Actions.USE, Input.Keys.E)
Pair(Actions.USE, Input.Keys.E),
Pair(Actions.QUIT, Input.Keys.ESCAPE)
)
)
}
3 changes: 3 additions & 0 deletions core/src/me/srikavin/fbla/game/ecs/system/InputSystem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ class InputSystem(private val listenerManager: ContactListenerManager) : Iterati
}
}
Actions.USE -> TODO()
Actions.QUIT -> {
Gdx.app.exit()
}
}
}
}
Expand Down

0 comments on commit 4a8f289

Please sign in to comment.