Changed alive checking

This commit is contained in:
Marcin Kostrzewski 2020-04-06 13:42:56 +02:00
parent b22e69712c
commit deec08cec7

View File

@ -1,3 +1,5 @@
from time import sleep
import pygame import pygame
from src.entities.Interactable import Interactable from src.entities.Interactable import Interactable
@ -32,6 +34,7 @@ class EventManager:
self.game.screen.ui.updateBasedOnPygameEvent(event) self.game.screen.ui.updateBasedOnPygameEvent(event)
self.keyTimeout += self.keyTimer.tick() self.keyTimeout += self.keyTimer.tick()
if self.keyTimeout >= TIMEOUT: if self.keyTimeout >= TIMEOUT:
if self.player.alive:
self.handlePlayerControls(keys) self.handlePlayerControls(keys)
self.keyTimeout = 0 self.keyTimeout = 0
@ -41,7 +44,6 @@ 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())