Merge branch 'master' of ctpug.org.za:tabakrolletjie
authorSimon Cross <hodgestar@gmail.com>
Sat, 10 Sep 2016 12:12:31 +0000 (14:12 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 10 Sep 2016 12:12:31 +0000 (14:12 +0200)
TODO.txt
tabakrolletjie/enemies.py
tabakrolletjie/scenes/night.py

index bfc582a8a0a79f87a7fcf7447607abfa3128e218..d859100113201563ce7a3d627022b6bdfc242e60 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -9,6 +9,8 @@ TODO
 * Save game
 * More sounds
 * Five levels
+* Sunrise transition screen
+* 'End the Day' button
 
 Done
 ====
index 59151d561d40bad83cc7a1711acb5c3339addc2c..80a0776ee4736ac63ab55c13144c7c00df226c54 100644 (file)
@@ -26,7 +26,7 @@ MAX_AGE = 60
 MAX_ELEMENTS = 400
 MAX_HEALTH = 100
 
-MOULD_STAGES = [10, 20]
+MOULD_STAGES = [15, 25]
 
 
 class Mould(pymunk.Body):
@@ -186,3 +186,6 @@ class Boyd(object):
     def render(self, surface):
         """Draw ourselves"""
         surface.blit(self._image, (0, 0), None, 0)
+
+    def alive(self):
+        return len(self._moulds) > 0
index f9935d32d761b7f1e9df8d9165b2db121b86cd77..6b42f6bf878dafad72ef01fc63077230c71cc8b4 100644 (file)
@@ -13,7 +13,7 @@ from ..utils import debug_timer
 from ..loader import loader
 from ..transforms import Overlay
 from ..turnip import Turnip
-from ..constants import NIGHT_LENGTH
+from ..constants import NIGHT_LENGTH, DEBUG
 
 
 class NightScene(BaseScene):
@@ -56,21 +56,28 @@ class NightScene(BaseScene):
             if ev.key in (pgl.K_q, pgl.K_ESCAPE):
                 from .menu import MenuScene
                 SceneChangeEvent.post(scene=MenuScene())
-            if ev.key == pgl.K_e:
-                from .day import DayScene
-                SceneChangeEvent.post(scene=DayScene())
+            if ev.key == pgl.K_e and DEBUG:
+                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]