projects
/
tabakrolletjie.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Increase Boyd's starting health over time
[tabakrolletjie.git]
/
tabakrolletjie
/
enemies.py
diff --git
a/tabakrolletjie/enemies.py
b/tabakrolletjie/enemies.py
index 59151d561d40bad83cc7a1711acb5c3339addc2c..02491aa5138fabd40c12e89dda350e98822e45ef 100644
(file)
--- a/
tabakrolletjie/enemies.py
+++ b/
tabakrolletjie/enemies.py
@@
-26,7
+26,12
@@
MAX_AGE = 60
MAX_ELEMENTS = 400
MAX_HEALTH = 100
MAX_ELEMENTS = 400
MAX_HEALTH = 100
-MOULD_STAGES = [10, 20]
+# Increase in health per day
+DAY_HEALTH = 10
+
+HEAL_FACTOR = 1
+
+MOULD_STAGES = [15, 25]
class Mould(pymunk.Body):
class Mould(pymunk.Body):
@@
-67,6
+72,9
@@
class Mould(pymunk.Body):
self._eyeball = loader.load_image("32", name)
return self._eyeball
self._eyeball = loader.load_image("32", name)
return self._eyeball
+ def set_health(self, new_health):
+ self._health = new_health
+
def tick(self, gamestate, space, moulds):
"""Grow and / or Die"""
def tick(self, gamestate, space, moulds):
"""Grow and / or Die"""
@@
-74,7
+82,7
@@
class Mould(pymunk.Body):
# we regain a health every tick, so we heal in the dark
if self._health < MAX_HEALTH:
# we regain a health every tick, so we heal in the dark
if self._health < MAX_HEALTH:
- self._health +=
1
+ self._health +=
HEAL_FACTOR
refresh = False
refresh = False
@@
-150,6
+158,7
@@
class Boyd(object):
self._moulds = []
for position in gamestate.get_spawn_positions():
seed = Mould(gamestate, space, position)
self._moulds = []
for position in gamestate.get_spawn_positions():
seed = Mould(gamestate, space, position)
+ seed.set_health(MAX_HEALTH + gamestate.days * DAY_HEALTH)
self._moulds.append(seed)
self._image = pygame.surface.Surface(SCREEN_SIZE)
self._image = self._image.convert_alpha(pygame.display.get_surface())
self._moulds.append(seed)
self._image = pygame.surface.Surface(SCREEN_SIZE)
self._image = self._image.convert_alpha(pygame.display.get_surface())
@@
-186,3
+195,6
@@
class Boyd(object):
def render(self, surface):
"""Draw ourselves"""
surface.blit(self._image, (0, 0), None, 0)
def render(self, surface):
"""Draw ourselves"""
surface.blit(self._image, (0, 0), None, 0)
+
+ def alive(self):
+ return len(self._moulds) > 0