From: Simon Cross Date: Sat, 10 Sep 2016 12:12:31 +0000 (+0200) Subject: Merge branch 'master' of ctpug.org.za:tabakrolletjie X-Git-Tag: tabakrolletjie-v1.0.0~112 X-Git-Url: https://git.ctpug.org.za/?p=tabakrolletjie.git;a=commitdiff_plain;h=e01720bca61df6c69cfa8a49f7029e54b697ffde;hp=772506e91d10df538f2dbbcb5cb0e27599672c61 Merge branch 'master' of ctpug.org.za:tabakrolletjie --- diff --git a/TODO.txt b/TODO.txt index bfc582a..d859100 100644 --- 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 ==== diff --git a/tabakrolletjie/enemies.py b/tabakrolletjie/enemies.py index 59151d5..80a0776 100644 --- a/tabakrolletjie/enemies.py +++ b/tabakrolletjie/enemies.py @@ -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 diff --git a/tabakrolletjie/scenes/night.py b/tabakrolletjie/scenes/night.py index f9935d3..6b42f6b 100644 --- a/tabakrolletjie/scenes/night.py +++ b/tabakrolletjie/scenes/night.py @@ -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]