X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=tabakrolletjie%2Fscenes%2Fnight.py;h=f9935d32d761b7f1e9df8d9165b2db121b86cd77;hb=28c8033fc20fc71e8a5e39fde868ac3f0ccac374;hp=d8f0e1a53144d9993734644cb3d5bc65d37abce7;hpb=618aba4ccd2f421ad022c31849d87dd7ef00121c;p=tabakrolletjie.git diff --git a/tabakrolletjie/scenes/night.py b/tabakrolletjie/scenes/night.py index d8f0e1a..f9935d3 100644 --- a/tabakrolletjie/scenes/night.py +++ b/tabakrolletjie/scenes/night.py @@ -13,6 +13,7 @@ from ..utils import debug_timer from ..loader import loader from ..transforms import Overlay from ..turnip import Turnip +from ..constants import NIGHT_LENGTH class NightScene(BaseScene): @@ -30,6 +31,7 @@ class NightScene(BaseScene): self._turnips.append(turnip) self._soil = loader.load_image( "textures", "soil.png", transform=self.DARKNESS) + self._total_ticks = 0 @debug_timer("night.render") def render(self, surface, gamestate): @@ -64,8 +66,11 @@ class NightScene(BaseScene): @debug_timer("night.tick") def tick(self, gamestate): - self._mould.tick(gamestate, self._space, self._lights) - self._lights.tick() + 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 def exit(self, gamestate): turnip_data = [turnip.serialize() for turnip in self._turnips]