from ..obstacles import ObstacleManager
from ..enemies import Boyd
from ..events import SceneChangeEvent
from ..obstacles import ObstacleManager
from ..enemies import Boyd
from ..events import SceneChangeEvent
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._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:
- '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
@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))
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)
if self._total_ticks < NIGHT_LENGTH:
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()
+ if self._total_ticks % 60 == 0:
+ self._battery.current -= int(
+ self._lights.total_power_usage())
+ self._total_ticks += 1
def exit(self, gamestate):
turnip_data = [turnip.serialize() for turnip in self._turnips]
gamestate.turnips = turnip_data
def exit(self, gamestate):
turnip_data = [turnip.serialize() for turnip in self._turnips]
gamestate.turnips = turnip_data