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]