self._draw_you_lose(gamestate)
elif gamestate.harvested >= gamestate.turnip_target:
self._draw_you_win(gamestate)
+ self._ending = False
def _draw_you_lose(self, gamestate):
overlay = pygame.surface.Surface(
gamestate.turnips = turnip_data
def end_day(self, gamestate):
+ if self._ending:
+ return
self._battery.apply_recharge()
gamestate.update_lights(self._lights)
+ self._ending = True
from .night import NightScene
SceneChangeEvent.post(scene=NightScene())
self._lights.add_light(cfg)
def event(self, ev, gamestate):
+ if self._ending:
+ return
if self._game_over_text:
if ev.type in (pgl.KEYDOWN, pgl.MOUSEBUTTONDOWN):
+ self._ending = True
from .menu import MenuScene
SceneChangeEvent.post(scene=MenuScene())
if ev.type == pgl.KEYDOWN:
if ev.key in (pgl.K_q, pgl.K_ESCAPE):
+ self._ending = True
from .menu import MenuScene
SceneChangeEvent.post(scene=MenuScene())
elif ev.key == pgl.K_e:
elif tool.name == 'start night':
self.end_day(gamestate)
elif tool.name == 'exit':
+ self._ending = True
from .menu import MenuScene
SceneChangeEvent.post(scene=MenuScene())
else:
self._paused = False
self._eaten_tonight = 0
self._night_over_text = []
+ self._ending = False
def create_tools(self, gamestate):
tools = []
surface.blit(text, text_pos, None)
def event(self, ev, gamestate):
+ if self._ending:
+ return
if ev.type == pgl.KEYDOWN:
if not self._do_ticks:
# Any keypress exits
self._to_day(gamestate)
if ev.key in (pgl.K_q, pgl.K_ESCAPE):
+ self._ending = True
from .menu import MenuScene
SceneChangeEvent.post(scene=MenuScene())
elif ev.key == pgl.K_e and DEBUG:
if tool.name == 'pause play':
self.toggle_pause()
elif tool.name == 'exit':
+ self._ending = True
from .menu import MenuScene
SceneChangeEvent.post(scene=MenuScene())
elif tool.name == 'day':
def _to_day(self, gamestate):
# End the night
+ if self._ending:
+ return
gamestate.update_lights(self._lights)
+ self._ending = True
from .day import DayScene
SceneChangeEvent.post(scene=DayScene())