Less complexity on the handle key function
This commit is contained in:
parent
41548504de
commit
887a190f11
|
@ -155,6 +155,12 @@ class Game:
|
||||||
elif key == KeyValues.WAIT:
|
elif key == KeyValues.WAIT:
|
||||||
self.map.tick()
|
self.map.tick()
|
||||||
elif key == KeyValues.LADDER:
|
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
|
# On a ladder, we switch level
|
||||||
y, x = self.player.y, self.player.x
|
y, x = self.player.y, self.player.x
|
||||||
if not self.map.tiles[y][x].is_ladder():
|
if not self.map.tiles[y][x].is_ladder():
|
||||||
|
|
Loading…
Reference in New Issue