Events won't be handled if the player is dead

This commit is contained in:
Marcin Kostrzewski 2020-04-06 12:05:57 +02:00
parent 605bf55ebf
commit e3b3fdd74f
2 changed files with 31 additions and 31 deletions

View File

@ -85,7 +85,6 @@ class Player(Entity):
return self.statistics return self.statistics
def rotate(self, rotation): def rotate(self, rotation):
if self.alive:
# If the player is not facing given direction, it will not move the first time, it will only get rotated # If the player is not facing given direction, it will not move the first time, it will only get rotated
if self.rotation.value != rotation.value: if self.rotation.value != rotation.value:
self.image = pygame.transform.rotate(self.image, ((self.rotation.value - rotation.value) * 90)) self.image = pygame.transform.rotate(self.image, ((self.rotation.value - rotation.value) * 90))

View File

@ -41,6 +41,7 @@ class EventManager:
# Key names are temporary # Key names are temporary
# TODO: Load key bindings from JSON # TODO: Load key bindings from JSON
if self.player.alive:
# Picking up items # Picking up items
if keys[pygame.K_SPACE]: if keys[pygame.K_SPACE]:
object = self.game.map.getEntityOnCoord(self.player.getFacingCoord()) object = self.game.map.getEntityOnCoord(self.player.getFacingCoord())