projects
/
tabakrolletjie.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
a583e42
)
Add infobar and battery manager to night.
author
Simon Cross
<hodgestar@gmail.com>
Sat, 10 Sep 2016 16:51:03 +0000
(18:51 +0200)
committer
Simon Cross
<hodgestar@gmail.com>
Sat, 10 Sep 2016 16:51:03 +0000
(18:51 +0200)
tabakrolletjie/scenes/night.py
patch
|
blob
|
history
diff --git
a/tabakrolletjie/scenes/night.py
b/tabakrolletjie/scenes/night.py
index 7d028d58f1688ac984a512e190cdd7b8e71ce2b3..99b903b84300d2e205e82f8568829e07b4e4a177 100644
(file)
--- a/
tabakrolletjie/scenes/night.py
+++ b/
tabakrolletjie/scenes/night.py
@@
-6,7
+6,9
@@
import pygame.locals as pgl
import pymunk
from .base import BaseScene
import pymunk
from .base import BaseScene
+from ..battery import BatteryManager
from ..lights import LightManager
from ..lights import LightManager
+from ..infobar import InfoBar
from ..obstacles import ObstacleManager
from ..enemies import Boyd
from ..events import SceneChangeEvent
from ..obstacles import ObstacleManager
from ..enemies import Boyd
from ..events import SceneChangeEvent
@@
-26,6
+28,8
@@
class NightScene(BaseScene):
self._space = pymunk.Space()
self._obstacles = ObstacleManager(self._space, gamestate)
self._lights = LightManager(self._space, gamestate)
self._space = pymunk.Space()
self._obstacles = ObstacleManager(self._space, gamestate)
self._lights = LightManager(self._space, gamestate)
+ self._battery = BatteryManager(gamestate)
+ self._infobar = InfoBar("day", battery=self._battery, scene=self)
self._mould = Boyd(gamestate, self._space)
self._turnips = []
for turnip_data in gamestate.turnips:
self._mould = Boyd(gamestate, self._space)
self._turnips = []
for turnip_data in gamestate.turnips:
@@
-44,11
+48,20
@@
class NightScene(BaseScene):
tools = []
y = SCREEN_SIZE[1] - 40
tools.append(ImageButton(
tools = []
y = SCREEN_SIZE[1] - 40
tools.append(ImageButton(
- '32', 'pause.png', name='pause play', pos=(SCREEN_SIZE[0] - 150, y)))
+ '32', 'pause.png', name='pause play',
+ pos=(SCREEN_SIZE[0] - 150, y)))
tools.append(ImageButton(
'32', 'exit.png', name='exit', pos=(SCREEN_SIZE[0] - 50, y)))
return tools
tools.append(ImageButton(
'32', 'exit.png', name='exit', pos=(SCREEN_SIZE[0] - 50, y)))
return tools
+ @property
+ def turnip_count(self):
+ return len(self._turnips)
+
+ @property
+ def power_usage(self):
+ return int(self._lights.total_power_usage())
+
@debug_timer("night.render")
def render(self, surface, gamestate):
surface.blit(self._soil, (0, 0))
@debug_timer("night.render")
def render(self, surface, gamestate):
surface.blit(self._soil, (0, 0))
@@
-67,6
+80,7
@@
class NightScene(BaseScene):
self._lights.render_light(surface)
self._obstacles.render(surface)
self._lights.render_fittings(surface)
self._lights.render_light(surface)
self._obstacles.render(surface)
self._lights.render_fittings(surface)
+ self._infobar.render(surface, gamestate)
for tool in self._tools:
tool.render(surface)
for tool in self._tools:
tool.render(surface)