MAX_ELEMENTS = 400
MAX_HEALTH = 100
-MOULD_STAGES = [10, 20]
+MOULD_STAGES = [15, 25]
class Mould(pymunk.Body):
def render(self, surface):
"""Draw ourselves"""
surface.blit(self._image, (0, 0), None, 0)
+
+ def alive(self):
+ return len(self._moulds) > 0
from .menu import MenuScene
SceneChangeEvent.post(scene=MenuScene())
if ev.key == pgl.K_e:
- from .day import DayScene
- SceneChangeEvent.post(scene=DayScene())
+ self._to_day()
elif ev.type == pgl.MOUSEBUTTONDOWN:
if ev.button == 1:
self._lights.toggle_nearest(ev.pos, surfpos=True)
print self._lights.lit_by(ev.pos, surfpos=True)
+ def _to_day(self):
+ # End the night
+ from .day import DayScene
+ SceneChangeEvent.post(scene=DayScene())
+
@debug_timer("night.tick")
def tick(self, gamestate):
if self._total_ticks < NIGHT_LENGTH:
self._mould.tick(gamestate, self._space, self._lights)
self._lights.tick()
print "Power usage: ", self._lights.total_power_usage()
- self._total_ticks += 1
+ else:
+ self._to_day()
+ if not self._mould.alive():
+ self._to_day()
def exit(self, gamestate):
turnip_data = [turnip.serialize() for turnip in self._turnips]