Changed fatigue

This commit is contained in:
Marcin Kostrzewski 2020-05-17 00:14:23 +02:00
parent 92490789ea
commit dcc8da6d2a

View File

@ -53,26 +53,19 @@ class Player(Entity):
""" """
# looses hunger # looses hunger
self.statistics.set_hunger(1.3) self.statistics.set_hunger(1.7)
# gets more thirsty # gets more thirsty
self.statistics.set_thirst(2.2) self.statistics.set_thirst(2.2)
# gets tired # gets tired
self.statistics.set_stamina(-1.5) self.statistics.set_stamina(-1.9)
def applyTimeFatigue(self, tickTime): def applyTimeFatigue(self):
""" """
A separate method to lower the statistics. Invoked every frame. A separate method to lower the statistics. Invoked every frame.
:param tickTime: Time passed between the previous frame (in milliseconds)
""" """
self.fatigueTimeout += tickTime self.statistics.set_thirst(0.002)
if self.fatigueTimeout >= 700: self.statistics.set_hunger(0.003)
self.statistics.set_thirst(5) self.statistics.set_stamina(-0.001)
self.statistics.set_hunger(3)
# A player can randomly regenerate stamina
if random.randrange(5) == 0:
self.statistics.set_stamina(2)
self.fatigueTimeout = 0
def getStatistic(self, stat): def getStatistic(self, stat):
""" """
@ -156,5 +149,6 @@ class Player(Entity):
# self.applyTimeFatigue(self.timer.get_time()) # COMMENTED FOR A_STAR_TEST # self.applyTimeFatigue(self.timer.get_time()) # COMMENTED FOR A_STAR_TEST
# Adds frame time to movementTimer # Adds frame time to movementTimer
self.movementTimer += self.timer.tick() self.movementTimer += self.timer.tick()
self.applyTimeFatigue()
self.updateEntityCoords() self.updateEntityCoords()
self.determineLife() self.determineLife()