def __init__( self, scenario, ground_control ): BaseDlg.__init__( self, scenario, ground_control ) self.no_input_timeout = 25*1 self.all_ready = False self.readys = None self.anim_timer = gfx.LoopAnimationTimer( 15, 0, 12 )
def draw(self, frame): for particle in self.particles: particle.render(frame.surface, frame.X_OFFSET, frame.Y_OFFSET) if self.animTimer is None: self.animTimer = gfx.LoopAnimationTimer( 20, 0, 16) # real maxframe is in draw self.animTimer.set_frame(frame.time_sec, 0) if self.sprite is not None: self.sprite.nr = self.animTimer.get_frame(frame.time_sec) self.sprite.draw(frame.surface, self.pos + Vec2D(frame.X_OFFSET, frame.Y_OFFSET)) if self.sprite.nr >= 15: self.sprite = None
def init_title_sprites( self ): self.title_sprite_left = None self.title_sprite_right = None self.title_sprite_left_y = 0 self.title_sprite_right_y = 0 if isinstance( self.scenario, scenarios.ScenarioCoinCollect ): self.title_sprite_left = resman.get("game.copper_sprite").clone() self.title_sprite_right = resman.get("game.copper_sprite").clone() self.left_anim_timer = gfx.LoopAnimationTimer( 25, 0, self.title_sprite_left.max_x ) self.right_anim_timer = gfx.LoopAnimationTimer( 25, 0, self.title_sprite_left.max_x ) self.title_sprite_left_y = 23 self.title_sprite_right_y = 23 elif isinstance( self.scenario, scenarios.ScenarioHoldLamp ): self.title_sprite_left = resman.get("game.lamp_sprite").clone() self.title_sprite_right = resman.get("game.lamp_sprite").clone() self.left_anim_timer = None self.right_anim_timer = None self.title_sprite_left_y = 33 self.title_sprite_right_y = 33 elif isinstance( self.scenario, scenarios.ScenarioCutter ): self.title_sprite_left = resman.get("game.axe_sprite").clone() self.title_sprite_right = resman.get("game.gold_sprite").clone() self.left_anim_timer = gfx.PingPongTimer( 25, 0, 8 ) self.right_anim_timer = gfx.LoopAnimationTimer( 25, 0, 15 ) self.title_sprite_left_y = 26 self.title_sprite_right_y = 33 elif isinstance( self.scenario, scenarios.ScenarioBlowup ): self.title_sprite_left = resman.get("game.dynamite_sprite").clone() self.title_sprite_right = resman.get("game.dynamite_sprite").clone() self.left_anim_timer = None self.right_anim_timer = None self.title_sprite_left_y = 35 self.title_sprite_right_y = 35 elif isinstance( self.scenario, scenarios.ScenarioRace ): self.title_sprite_left = resman.get("game.flag1_sprite").clone() self.title_sprite_right = resman.get("game.flag2_sprite").clone() self.left_anim_timer = gfx.LoopAnimationTimer( 20, 0, 8 ) self.right_anim_timer = gfx.LoopAnimationTimer( 20, 0, 8 ) self.title_sprite_left_y = 7 self.title_sprite_right_y = 7 elif isinstance( self.scenario, scenarios.ScenarioCollectRocks ): self.title_sprite_left = resman.get("game.rock_sprite").clone() self.title_sprite_right = resman.get("game.rock_sprite").clone() self.left_anim_timer = gfx.LoopAnimationTimer( 25, 0, 15 ) self.right_anim_timer = gfx.LoopAnimationTimer( 25, 0, 15 ) self.title_sprite_left_y = 39 self.title_sprite_right_y = 39 elif isinstance( self.scenario, scenarios.ScenarioDiamondCollect ): self.title_sprite_left = resman.get("game.diamond_sprite").clone() self.title_sprite_right = resman.get("game.diamond_sprite").clone() self.left_anim_timer = gfx.LoopAnimationTimer( 25, 0, 4 ) self.right_anim_timer = gfx.LoopAnimationTimer( 25, 0, 4 ) self.title_sprite_left_y = 27 self.title_sprite_right_y = 27 elif isinstance( self.scenario, scenarios.ScenarioCollectAll ): self.title_sprite_left = resman.get("game.copper_sprite").clone() self.title_sprite_right = resman.get("game.diamond_sprite").clone() self.left_anim_timer = gfx.LoopAnimationTimer( 25, 0, self.title_sprite_left.max_x ) self.right_anim_timer = gfx.LoopAnimationTimer( 25, 0, 4 ) self.title_sprite_left_y = 23 self.title_sprite_right_y = 27 elif isinstance( self.scenario, scenarios.ScenarioPacman ): self.title_sprite_left = resman.get("game.copper_sprite").clone() self.title_sprite_right = resman.get("game.copper_sprite").clone() self.left_anim_timer = gfx.LoopAnimationTimer( 25, 0, self.title_sprite_left.max_x ) self.right_anim_timer = gfx.LoopAnimationTimer( 25, 0, self.title_sprite_left.max_x ) self.title_sprite_left_y = 23 self.title_sprite_right_y = 23