Fight other entities

This commit is contained in:
Yohann D'ANELLO
2020-11-11 00:50:47 +01:00
parent 5addd42535
commit 9909b12501
3 changed files with 24 additions and 0 deletions

View File

@ -24,6 +24,7 @@ class KeyValues(Enum):
RIGHT = auto()
ENTER = auto()
SPACE = auto()
FIGHT = auto()
class Game:
@ -88,6 +89,8 @@ class Game:
elif key in (self.settings.KEY_UP_PRIMARY,
self.settings.KEY_UP_SECONDARY):
return KeyValues.UP
elif key == self.settings.KEY_FIGHT:
return KeyValues.FIGHT
elif key == self.settings.KEY_ENTER:
return KeyValues.ENTER
elif key == ' ':
@ -122,6 +125,9 @@ class Game:
elif key == KeyValues.RIGHT:
if self.player.move_right():
self.map.tick()
elif key == KeyValues.FIGHT:
if self.player.fight():
self.map.tick()
elif key == KeyValues.SPACE:
self.state = GameMode.MAINMENU