X-Git-Url: https://git.ctpug.org.za/?p=tabakrolletjie.git;a=blobdiff_plain;f=tabakrolletjie%2Fscenes%2Fnight.py;h=580d140a6941475cfeefc1f295e2b51ec82312b7;hp=e4cc73384b9c433f61755cfd16fe73a35226770f;hb=923e068edb27b9b6d35359e496668038a1db6fa4;hpb=48c809306d2aaf6ed2487aad4970138601d74a60 diff --git a/tabakrolletjie/scenes/night.py b/tabakrolletjie/scenes/night.py index e4cc733..580d140 100644 --- a/tabakrolletjie/scenes/night.py +++ b/tabakrolletjie/scenes/night.py @@ -18,13 +18,13 @@ from ..transforms import Overlay from ..turnip import Turnip from ..widgets import ImageButton from ..constants import ( - NIGHT_LENGTH, NIGHT_LENGTH_HOURS, DEBUG, FONTS, SCREEN_SIZE, FPS) + NIGHT_LENGTH, NIGHT_HOURS_PER_TICK, DEBUG, FONTS, + SCREEN_SIZE, FPS) class NightScene(BaseScene): DARKNESS = Overlay(colour=(0, 0, 0, 150)) - HOURS_PER_TICK = float(NIGHT_LENGTH_HOURS) / NIGHT_LENGTH def enter(self, gamestate): self._space = pymunk.Space() @@ -69,11 +69,13 @@ class NightScene(BaseScene): @property def power_usage(self): - return int(self._lights.total_power_usage()) + power = self._lights.total_power_usage() + power = power / (FPS * NIGHT_HOURS_PER_TICK) + return int(round(power)) def remaining_hours(self): return int(round( - (NIGHT_LENGTH - self._total_ticks) * self.HOURS_PER_TICK)) + (NIGHT_LENGTH - self._total_ticks) * NIGHT_HOURS_PER_TICK)) @debug_timer("night.render") def render(self, surface, gamestate):