changeset 309:2b0494b3ce6a

Werewolf form heals every second.
author Jeremy Thurgood <firxen@gmail.com>
date Fri, 06 Sep 2013 00:41:14 +0200
parents 3dee86b6c216
children fa408430a174
files nagslang/protagonist.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/nagslang/protagonist.py	Fri Sep 06 00:36:14 2013 +0200
+++ b/nagslang/protagonist.py	Fri Sep 06 00:41:14 2013 +0200
@@ -59,6 +59,7 @@
         self.health_level = 100
 
         self.go_human()
+        self._time = 0
 
     def _make_physics(self, space, position):
         body = make_body(10, pymunk.inf, position, 0.8)
@@ -299,3 +300,11 @@
         self.health_level += amount
         if self.health_level > PROTAGONIST_HEALTH_MAX_LEVEL:
             self.health_level = PROTAGONIST_HEALTH_MAX_LEVEL
+
+    def update(self, dt):
+        last_secs = int(self._time)
+        self._time += dt
+        secs = int(self._time)
+        if self.form == self.WOLF_FORM and secs > last_secs:
+            self.gain_health(1)
+        super(Protagonist, self).update(dt)