def ready(self): self.scene.world = World(players=self.scene.num_players, timer=self.scene.timer) self.scene.navigations = [] for player in self.scene.world.players: self.scene.navigations.append(Navigation(player)) self.text.ainfo.index = 0 self.scene.bgm.set_volume(0.7) self.start_sound = Sound("../resources/sound/start.wav") self.scene.timer.reset() self.scene.timer.update() self.ready_timer = Timer(settings.FPS*3) self.ready_timer.play()
def ready(self, *args, **kwargs): self.background = Image(u'../resources/image/main/background.png') self.frame = Image(u'../resources/image/main/frame.png', x=settings.STAGE_OFFSET[0]-15, y=settings.STAGE_OFFSET[1]-15) self.stage = Stage(args[0], args[1]) self.bgm = BGM(u'../resources/bgm/game_intro.wav', -1, u'../resources/bgm/game_loop.wav') self.background.draw() self.frame.draw() self.navigation = Navigation(self.stage) self.sequence_mng = SceneManager({'ready':ReadySequence(self.frame, self.background), 'main': MainSequence(self.stage, self.navigation), 'result':ResultSequence(self.stage, self.navigation, self.frame, self.bgm), 'pause':PauseSequence(self.navigation)}) def init(): if settings.DEBUG: return 'main' else: return 'ready' self.sequence_mng.change_scene(init()) self.redraw = False Effect.reset() self.draw()
class GameScene(Scene): def ready(self, *args, **kwargs): self.background = Image(u'../resources/image/main/background.png') self.frame = Image(u'../resources/image/main/frame.png', x=settings.STAGE_OFFSET[0]-15, y=settings.STAGE_OFFSET[1]-15) self.stage = Stage(args[0], args[1]) self.bgm = BGM(u'../resources/bgm/game_intro.wav', -1, u'../resources/bgm/game_loop.wav') self.background.draw() self.frame.draw() self.navigation = Navigation(self.stage) self.sequence_mng = SceneManager({'ready':ReadySequence(self.frame, self.background), 'main': MainSequence(self.stage, self.navigation), 'result':ResultSequence(self.stage, self.navigation, self.frame, self.bgm), 'pause':PauseSequence(self.navigation)}) def init(): if settings.DEBUG: return 'main' else: return 'ready' self.sequence_mng.change_scene(init()) self.redraw = False Effect.reset() self.draw() def update(self): super(GameScene, self).update() self.bgm.play() next = self.sequence_mng.current_scene.update() if next: self.redraw = True self.sequence_mng.change_scene(next) def draw(self): super(GameScene, self).draw() if self.redraw: self.redraw = False self.background.draw() self.frame.draw() if self.stage.redraw_frame(): self.frame.draw() #マップのはじで回転させたとき、回転の軌跡が残ってしまうため、フレームを再描画 rect_draw = self.stage.draw() rect_draw += self.navigation.draw() rect_draw += self.sequence_mng.current_scene.draw() return rect_draw