Less complexity on the handle key function

This commit is contained in:
Yohann D'ANELLO 2021-01-06 17:00:43 +01:00
parent 41548504de
commit 887a190f11
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 45 additions and 39 deletions

View File

@ -155,6 +155,12 @@ class Game:
elif key == KeyValues.WAIT:
self.map.tick()
elif key == KeyValues.LADDER:
self.handle_ladder()
def handle_ladder(self) -> None:
"""
The player pressed the ladder key to switch map
"""
# On a ladder, we switch level
y, x = self.player.y, self.player.x
if not self.map.tiles[y][x].is_ladder():