def __init__(self, game, priority): super(DrunkMultiball, self).__init__(game, priority) self.myID = "Drunk Multiball" anim = self.game.assets.dmd_dmbIdle self.overlay = dmd.AnimatedLayer(frames=anim.frames, hold=False, opaque=False, repeat=True, frame_time=8) self.shotModes = [ self.game.lamp_control.left_loop, self.game.lamp_control.right_loop, self.game.lamp_control.left_ramp, self.game.lamp_control.center_ramp, self.game.lamp_control.right_ramp ] self.shots = [ 'leftLoopStage', 'leftRampStage', 'centerRampStage', 'rightLoopStage', 'rightRampStage' ] self.availableJackpots = [ 'leftLoop', 'leftRamp', 'centerRamp', 'rightLoop', 'rightRamp' ] # an animation for use in the intro anim = self.game.assets.dmd_reverse self.underLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=False, repeat=False) self.starting = False self.giOff = 'Disabled' == self.game.user_settings[ 'Gameplay (Feature)']['Drunk Multiball GI'] self.enabled = 'Enabled' == self.game.user_settings[ 'Gameplay (Feature)']['Drunk Multiball'] self.beerHit = False
def jackpot_wiff(self,step=1): if step == 1: layerCopy = self.layer # load the animation based on which was last played anim = self.anims[0] banner = self.banners[0] myWait = len(banner.frames) / 12.0 # reverse them for next time self.anims.reverse() self.banners.reverse() # play an animation animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=False,repeat=False,frame_time=5) animLayer.composite_op = "blacksrc" bannerLayer = dmd.AnimatedLayer(frames=banner.frames,hold=True, opaque=False,repeat=False,frame_time=5) textLayer = ep.EP_TextLayer(64,13,self.game.assets.font_13px_score,"center",opaque=False) textLayer.composite_op = "blacksrc" # frame listener to set the text on the score display animLayer.add_frame_listener(19, lambda: textLayer.set_text(ep.format_score(self.game.show_tracking('Stampede Value')),color=ep.MAGENTA,blink_frames=8)) #bannerLayer.composite_op = "blacksrc" if layerCopy: combined = dmd.GroupedLayer(128,32,[layerCopy,bannerLayer,textLayer,animLayer]) else: combined = dmd.GroupedLayer(128,32,[bannerLayer,textLayer,animLayer]) combined.composite_op = "blacksrc" self.layer = combined # and some sounds self.game.sound.play(self.game.assets.sfx_flyByNoise) self.delay(delay=1,handler=self.game.base.play_quote,param=self.game.assets.quote_stampedeWiff) self.delay(name="Display", delay=myWait, handler=self.main_display)
def shift(self,direction): # move the active shot # Going right if direction == 1: self.active += 1 # just in case if self.active > 4: self.active = 4 # going Left else: self.active -= 1 # just in case if self.active < 0: self.active = 0 # update the lamps self.lamp_update() # now we need to start a timer for pulling back to center # If we're in the One away, set the long timer if self.is_near(): self.time = self.longTimer + 1 self.shift_timer() # If we're two away, set the short timer if self.is_far(): self.time = self.shortTimer + 1 self.shift_timer() layerCopy = self.layer # Set the cow animation anim = self.anims[direction] banner = self.banners[direction] myWait = len(banner.frames) / 12.0 # play an animation animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=False,repeat=False,frame_time=5) animLayer.composite_op = "blacksrc" bannerLayer = dmd.AnimatedLayer(frames=banner.frames,hold=True, opaque=False,repeat=False,frame_time=5) textLayer = ep.EP_TextLayer(64,13,self.game.assets.font_13px_score,"center",opaque=False) textLayer.composite_op = "blacksrc" # frame listener to set the text on the score display animLayer.add_frame_listener(19, lambda: textLayer.set_text(ep.format_score(self.baseValue),color=ep.MAGENTA,blink_frames=8)) #bannerLayer.composite_op = "blacksrc" if layerCopy: combined = dmd.GroupedLayer(128,32,[layerCopy,bannerLayer,textLayer,animLayer]) else: combined = dmd.GroupedLayer(128,32,[bannerLayer,textLayer,animLayer]) combined.composite_op = "blacksrc" self.layer = combined # and some sounds self.game.sound.play(self.game.assets.sfx_flyByNoise) self.delay(delay=1,handler=self.game.base.play_quote,param=self.game.assets.quote_stampedeWiff) self.delay(name="Display", delay=myWait, handler=self.main_display)
def display_it(self, type=None, startup=False): self.cancel_delayed("Display") if type == "idle": anim = self.game.assets.dmd_tafItIdle myWait = len(anim.frames) / 2.0 self.cousinLayer = dmd.AnimatedLayer(frames=anim.frames, hold=False, opaque=False, repeat=True, frame_time=30) elif type == "miss": anim = self.misses[0] self.misses.reverse() myWait = len(anim.frames) / 10.0 self.cousinLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=False, repeat=False, frame_time=6) elif type == "hit": anim = self.game.assets.dmd_tafItHit myWait = len(anim.frames) / 10.0 self.cousinLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=False, repeat=False, frame_time=6) else: # if we didn't get a cue to change cousin it, we don't mess with him myWait = 0 # build the layer self.cousinLayer.composite_op = "blacksrc" combined = dmd.GroupedLayer(128, 32, [ self.timerLayer, self.valueTitleLayer, self.valueLayer, self.totalTitleLayer, self.totalLayer, self.cousinLayer ]) # turn on the layer - crossfade at startup if startup: current = self.layer transition = ep.EP_Transition(self, current, combined, ep.EP_Transition.TYPE_CROSSFADE) else: self.layer = combined # set the delay for fixing it after a hit or a miss if myWait > 0: self.delay("Display", delay=myWait, handler=self.display_it, param="idle")
def anim_river_ride(self): self.game.sound.play(self.game.assets.sfx_horse) anim = self.game.assets.dmd_blankRiverLoop backdrop = dmd.AnimatedLayer(frames=anim.frames, repeat=True, opaque=True, frame_time=6) anim = self.game.assets.dmd_horseLoop horse = dmd.AnimatedLayer(frames=anim.frames, repeat=True, frame_time=6) horse.composite_op = "blacksrc" combined = dmd.GroupedLayer(128, 32, [backdrop, horse]) self.layer = combined self.delay(name="Display", delay=2, handler=self.show_award_text)
def gunfight_intro_draw(self,badGuys): # pop the last bad guy enemy = badGuys.pop(0) print "POP ENEMY: " + str(enemy) # need this for the lost self.enemy = enemy self.game.bad_guys.target_up(enemy) # play the 4 bells if not self.hard: self.game.sound.play(self.game.assets.sfx_gunfightBell) # flash the gun flashers self.game.coils.leftGunFlasher.schedule(0x00020821,cycle_seconds=1) self.game.coils.rightGunFlasher.schedule(0x00020821,cycle_seconds=1) self.delay("Operational",delay=0.6,handler=self.game.sound.play,param=self.game.assets.sfx_gunCock) # run the animation anim = self.game.assets.dmd_gunfightBoots myWait = len(anim.frames) / 10.0 animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=True,repeat=False,frame_time=6) self.layer = animLayer else: myWait = 0.2 # flash the gun flashers self.game.coils.leftGunFlasher.schedule(0x00000021,cycle_seconds=1) self.game.coils.rightGunFlasher.schedule(0x00000021,cycle_seconds=1) # pass one last time to the release self.delay("Operational",delay=myWait,handler=self.gunfight_release)
def loadIntoCache(self,key,frametime=1,file=None,repeatAnim=False,holdLastFrame=False, opaque = False, composite_op = None, x_loc =0, y_loc=0, streaming_load=False): if(file==None): file=key + '.vga.dmd.zip' self.updateProgressBar("Animations", file) tmp = None if(self.loaded_map.has_key(file) and not streaming_load): tmp = self.animations[self.loaded_map[file]] #print("quick loaded '%s'" % key) else: if(not streaming_load): tmp = dmd.Animation().load(self.dmd_path + file , composite_op=composite_op) self.loaded_map[file] = key if(tmp is not None): self.lengths[key] = tmp.frames[-1] if(len(tmp.frames)==1): holdLastFrame = True # self.logger.info("Single frame animtation '%s'; setting holdLastFrame to True" % file) if(streaming_load): self.animations[key] = dmd.MovieLayer(opaque, hold=holdLastFrame, repeat=repeatAnim, frame_time=frametime, movie_file_path=self.dmd_path + file, transparency_op=composite_op) else: self.animations[key] = dmd.AnimatedLayer(frames=tmp.frames, frame_time=frametime, repeat=repeatAnim, hold=holdLastFrame, opaque = opaque) self.animations[key].set_target_position(x_loc, y_loc) # if composite_op != None: # self.animations[key].composite_op = composite_op self.numLoaded += 1
def light_extra_ball(self,callback=None): # add the ball to the pending extra balls derp = self.game.increase_tracking('extraBallsPending') print "EXTRA BALLS PENDING: " + str(derp) # audit tick self.game.game_data['Audits']['Extra Balls Earned'] += 1 # open the mine if self.game.mountain.mineTicks != 8: self.game.mountain.full_open() # setup a bunch of text textLine1 = ep.EP_TextLayer(28, 4, self.game.assets.font_9px_az, "center", opaque=False).set_text("EXTRA",color=ep.ORANGE) textLine2 = ep.EP_TextLayer(28, 16, self.game.assets.font_9px_az, "center", opaque=False).set_text("BALL",color=ep.ORANGE) textLine3 = ep.pulse_text(self,96,4,"IS",color=ep.GREEN) textLine4 = ep.pulse_text(self,96,16,"LIT",sequence=[1,3],color=ep.GREEN) # and a backdrop backdrop = dmd.FrameLayer(opaque=True, frame=self.game.assets.dmd_ball.frames[0]) # and the wipe animation anim = self.game.assets.dmd_horseWipeRight myWait = len(anim.frames) / 10.0 + 1 animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=False,repeat=False,frame_time=6) animLayer.composite_op = "blacksrc" # slap it all together composite = dmd.GroupedLayer(128,32,[backdrop,textLine1,textLine2,textLine3,textLine4,animLayer]) # and turn it on self.layer = composite # with a sound effect self.game.sound.play(self.game.assets.sfx_leftLoopEnter) # play a quote self.play_ordered_quote(self.game.assets.quote_extraBallLit,'lit_extra_ball') self.lamp_update() # callback process for calling from skill shot if callback: self.delay(delay=myWait,handler=callback) self.delay("Display",delay=myWait,handler=self.clear_layer) print "EXTRA BALL LIT"
def won(self): # audit self.game.game_data['Feature']['Gunfights Won'] += 1 self.win = True self.shooting = False # set some tracking self.game.increase_tracking('gunfightsWon') # only kill the music if there's not a higher level running self.stop_music(slice=1) # cancel the lose delay self.cancel_delayed("Gunfight Lost") self.game.sound.play(self.game.assets.sfx_gunfightShot) # call increase rank with the True flag to trigger the gunfight quote option rankTitle,duration = self.game.badge.increase_rank(True) # the melodic flourish noise self.delay("Operational",delay=0.2,handler=self.game.sound.play,param=self.game.assets.sfx_gunfightFlourish) # flash the guns self.game.base.guns_flash(1) # play the animation anim = self.game.assets.dmd_dudeShotShouldersUp myWait = len(anim.frames) / 10.0 animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=True,repeat=False,frame_time=6) self.layer = animLayer # after the animation, display the win self.delay("Operational",delay=myWait,handler=self.display_win,param=rankTitle)
def intro(self, step=1): if step == 1: self.stop_music() anim = self.game.assets.dmd_tafItIntro myWait = len(anim.frames) / 10.0 animLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=True, repeat=False, frame_time=6) self.game.sound.play(self.game.assets.sfx_tafDitty) self.layer = animLayer self.delay(delay=myWait + 1, handler=self.intro, param=2) if step == 2: textLayer1 = ep.EP_TextLayer(64, 1, self.game.assets.font_9px_az, "center", False).set_text("HIT COUSIN IT") textLayer2 = ep.EP_TextLayer( 64, 11, self.game.assets.font_7px_az, "center", False).set_text("ALL SHOTS = " + str(ep.format_score(self.value))) textLayer3 = ep.EP_TextLayer( 64, 20, self.game.assets.font_9px_az, "center", False).set_text("'IT' INCREASES VALUE") border = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_singlePixelBorder.frames[0]) combined = dmd.GroupedLayer( 128, 32, [border, textLayer1, textLayer2, textLayer3]) current = self.layer transition = ep.EP_Transition(self, current, combined, ep.EP_Transition.TYPE_CROSSFADE) self.game.sound.play(self.game.assets.quote_itsCousinIt) self.delay(delay=3, handler=self.get_going)
def start_stampede(self): # reset the jackpot count, just in case self.jackpots = 0 # set the stack layer self.game.stack_level(4,True) self.running = True # stop the current music self.stop_music() # set the ramp status for lights -- outdated lamp_control doesn't use for shot in self.shots: print "SETTING TRACKING FOR:" + shot self.game.set_tracking(shot,89) # udpate the lamps self.lamp_update() # If the multiball ball savers are a thing, do that self.game.base.multiball_saver() #play the opening anim anim = self.game.assets.dmd_stampede myWait = len(anim.frames) / 10 + 1.5 animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=True,repeat=False,frame_time=6) self.layer = animLayer # toss to the main display after the animation self.delay(name="Display",delay=myWait,handler=self.main_display) # play a quote self.game.base.priority_quote(self.game.assets.quote_stampedeStart) # start the music for stampede - delay this music start in case a quickdraw started at the same time self.delay(delay=1.5,handler=self.music_on,param=self.game.assets.music_stampede) # launch some more balls if self.game.trough.num_balls_in_play < 4: total = 4 - self.game.trough.num_balls_in_play # turn on autoplunge self.game.trough.balls_to_autoplunge = total # launch whatever it takes to get to 3 balls self.game.trough.launch_balls(total)
def train_victory(self): start_value = self.game.increase_tracking('adventureCompleteValue',5000) if self.game.save_polly.won: self.awardString = "POLLY SAVED" value = start_value complete_color = ep.GREEN # play the short chug self.game.sound.play(self.game.assets.sfx_trainChugShort) else: self.awardString = "POLLY DIED" value = start_value / 10 self.game.sound.play(self.game.assets.sfx_glumRiffShort) complete_color = ep.RED anim = self.game.assets.dmd_trainHeadOn trainLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=True,repeat=True,frame_time=6) textLine1 = ep.EP_TextLayer(37,1,self.game.assets.font_7px_az,justify="center",opaque=False).set_text("TIED TO",color=ep.YELLOW) textLine2 = ep.EP_TextLayer(37,9,self.game.assets.font_7px_az,justify="center",opaque=False).set_text("THE TRACKS",color=ep.YELLOW) textLine3 = ep.EP_TextLayer(37,20,self.game.assets.font_7px_az,justify="center",opaque=False).set_text("COMPLETED",color=complete_color) combined = dmd.GroupedLayer(128,32,[trainLayer,textLine1,textLine2,textLine3]) self.layer = combined myWait = 1.5 self.delay(name="Display",delay=myWait,handler=self.show_award_text) self.awardPoints = str(ep.format_score(value)) self.game.score(value,bonus=True)
def start_bank_robbery(self,step=1): if step == 1: # audit self.game.game_data['Feature']['Right Polly Started'] += 1 # set the level 1 stack flag self.game.stack_level(2,True) # set the running flag self.running = True self.lamp_update() ## TEMP PLAY INTRO duration = self.game.base.priority_quote(self.game.assets.quote_hatbDox) # Secondary intro quote self.delay("Operational",delay=duration+0.1,handler=lambda: self.play_ordered_quote(self.game.assets.quote_hatbIntro,'start')) # start the music self.music_on(self.game.assets.music_altPeril) # run the animation anim = self.game.assets.dmd_pollyIntro myWait = len(anim.frames) / 30.0 animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=True,repeat=False,frame_time=2) self.layer = animLayer # loop back for the title card self.delay(delay=myWait,handler=self.start_bank_robbery,param=2) if step == 2: # pick a shoot delay self.set_shot_target() # set up the title card titleCard = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_hatbTitle.frames[0]) # transition to the title card self.transition = ep.EP_Transition(self,self.layer,titleCard,ep.EP_Transition.TYPE_WIPE,ep.EP_Transition.PARAM_EAST) # delay the start process self.delay("Get Going",delay=2,handler=self.in_progress)
def award_mootherlode(self, times): moo = times + 3 mooLayer = ep.EP_AnimatedLayer(self.game.assets.dmd_moother) mooLayer.frame_time = 4 mooLayer.opaque = True mooLayer.repeat = True mooLayer.hold = False scoreText = moo * self.displayMotherlodeValue self.game.score(scoreText) mooText = dmd.TextLayer(70, 12, self.game.assets.font_12px_az_outline, "center", opaque=False) mooText.composite_op = "blacksrc" mooText.set_text(str(ep.format_score(scoreText)), blink_frames=12) anim = self.game.assets.dmd_explosionWipe2 animLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=False, repeat=False, frame_time=6) animLayer.composite_op = "blacksrc" combined = dmd.GroupedLayer(128, 32, [mooLayer, mooText, animLayer]) self.game.sound.play(self.game.assets.sfx_cow3) self.layer = combined self.delay("Display", delay=3, handler=self.main_display) self.game.mountain.kick() self.bandits = False
def mode_started(self): # fire up the switch block if it's not already loaded self.game.switch_blocker('add', self.myID) self.game.peril = True self.shotsSoFar = 0 self.running = False self.halted = False self.won = False self.distance_value = int(30.0 / self.shotsToWin) self.totalPoints = 0 # holder for total points for the mode earned self.valueMultiplier = 1 # shot value multiplier self.extendedCount = 0 self.gotPaused = False # was the mode paused at any point self.lastPoints = 0 self.winMultiplier = 3 self.winBonus = 0 # position for the horse self.x_pos = 6 # point value for shots self.shotValue = 100000 # movement distance value self.distance = 0 self.banner = False self.won = False # set the timer self.modeTimer = self.game.user_settings['Gameplay (Feature)'][ 'Save Polly Timer - River'] self.modeTimer += 1 # set up the layers anim = self.game.assets.dmd_blankRiverLoop self.backdrop = dmd.AnimatedLayer(frames=anim.frames, repeat=True, opaque=True, frame_time=6) anim = self.game.assets.dmd_horseLoop self.horse = dmd.AnimatedLayer(frames=anim.frames, repeat=True, frame_time=6) self.horse.composite_op = "blacksrc" anim = self.game.assets.dmd_rowboatLoop self.boat = dmd.AnimatedLayer(frames=anim.frames, repeat=True, frame_time=6) self.boat.composite_op = "blacksrc"
def update_display(self, killed=99, escaped=99): # have to load the animations here so they can be used more than once ## setup the shot guys shotLayers = [] shotguy = self.game.assets.dmd_dudeShotFullBody escapeLayers = [] guyShoots = self.game.assets.dmd_dudeShoots for position in [-49, -16, 15, 47]: # the gets shot animation per position deadGuy0 = dmd.AnimatedLayer(frames=shotguy.frames, hold=True, opaque=False, repeat=False, frame_time=6) deadGuy0.set_target_position(position, 0) deadGuy0.composite_op = "blacksrc" shotLayers.append(deadGuy0) # the shoots back animation per position eGuy0 = ep.EP_AnimatedLayer(guyShoots) eGuy0.hold = True eGuy0.frame_time = 6 eGuy0.set_target_position(position, 0) eGuy0.composite_op = "blacksrc" eGuy0.add_frame_listener(2, self.game.sound.play, param=self.game.assets.sfx_explosion11) eGuy0.add_frame_listener(4, self.game.sound.play, param=self.game.assets.sfx_explosion11) # on any escape other than the last one, taunt the player - the last one would get stepped on by the final quote if self.misses != self.LOSE: eGuy0.add_frame_listener(5, self.game.base.play_quote, param=self.game.assets.quote_gunFail) escapeLayers.append(eGuy0) # loop through the up bad guys and add them to the display activeLayers = [] for x in self.activatedBadGuys: activeLayers.append(self.guyLayers[x]) # if we're here because someone got killed, add them to the layers to die if killed != 99: activeLayers.append(shotLayers[killed]) # play a shot sound self.game.sound.play(self.game.assets.sfx_gunfightShot) if escaped != 99: activeLayers.append(escapeLayers[escaped]) amount = self.LOSE - self.misses self.game.base.red_flasher_flourish() self.delay("Ambush", delay=0.5, handler=self.game.interrupter.dude_escaped, param=amount) combined = dmd.GroupedLayer(128, 32, activeLayers) combined.composite_op = "blacksrc" self.layer = combined
def mayor_pan(self): anim = self.game.assets.dmd_mayorPan animLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=True, repeat=False) self.layer = animLayer myWait = len(anim.frames) / 60.0 # when the pan finishes play the animation to reveal the award self.delay(delay=myWait, handler=self.award_bounty)
def show_marksman_award(self): anim = self.game.assets.dmd_smokingCard animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=False,opaque=True,repeat=True,frame_time=7) awardTextTop = ep.EP_TextLayer(128/3,3,self.game.assets.font_5px_bold_AZ,justify="center",opaque=False) awardTextBottom = ep.EP_TextLayer(128/3,11,self.game.assets.font_15px_az,justify="center",opaque=False) awardTextTop.set_text(self.awardString,color=ep.BROWN) awardTextBottom.set_text(self.awardPoints,color=ep.RED) completeFrame = dmd.GroupedLayer(128, 32, [animLayer,awardTextTop,awardTextBottom]) self.layer = completeFrame self.delay(name="Display",delay=2,handler=self.clear_layer)
def gunfight_pan(self,badGuys): # the intro animation anim = self.game.assets.dmd_gunfightPan myWait = len(anim.frames) / 30 + 1.2 animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=True,repeat=False,frame_time=2) self.layer = animLayer # Split here for optional HARD setting if self.hard: handler = self.gunfight_intro_hard else: handler = self.gunfight_intro_eyes self.delay("Operational",delay=myWait,handler=handler,param=badGuys)
def __init__(self, game, priority, left_players_justify="right"): super(ScoreDisplay, self).__init__(game, priority) self.layer = ScoreLayer(128, 32, self) self.font_common = self.game.assets.font_07x5 self.set_left_players_justify(left_players_justify) anim = self.game.assets.dmd_1pBurnCycle self.burnLayer1p = dmd.AnimatedLayer(frames=anim.frames, hold=False, opaque=False, repeat=True, frame_time=3) self.burnLayer1p.composite_op = "blacksrc"
def __init__(self,game,priority): super(CvA, self).__init__(game,priority) self.myID = "Cowboys VS Aliens" # the shots and their modes for ship mode self.shotModes = [self.game.left_loop,self.game.right_loop,self.game.left_ramp,self.game.center_ramp,self.game.right_ramp] self.shots = ['leftLoopStage','leftRampStage','centerRampStage','rightLoopStage','rightRampStage'] self.positions = [-58,-31,-4,23,50,77,104] self.direction = ["LEFT","RIGHT"] self.posts = [self.game.coils.leftGunFightPost,self.game.coils.rightGunFightPost] self.giActive = 'Default' == self.game.user_settings['Gameplay (Feature)']['CVA GI Behavior'] self.targetNames = ['Left','Left Center','Right Center','Right'] # setup the standing aliens anim = self.game.assets.dmd_cvaStandingAlien0 self.alienLayers = [] self.alien0 = dmd.AnimatedLayer(frames=anim.frames,hold=False,opaque=False,repeat=True,frame_time=6) self.alien0.composite_op = "blacksrc" self.alienLayers.append(self.alien0) anim = self.game.assets.dmd_cvaStandingAlien1 self.alien1 = dmd.AnimatedLayer(frames=anim.frames,hold=False,opaque=False,repeat=True,frame_time=6) self.alien1.composite_op = "blacksrc" self.alienLayers.append(self.alien1) anim = self.game.assets.dmd_cvaStandingAlien2 self.alien2 = dmd.AnimatedLayer(frames=anim.frames,hold=False,opaque=False,repeat=True,frame_time=6) self.alien2.composite_op = "blacksrc" self.alienLayers.append(self.alien2) anim = self.game.assets.dmd_cvaStandingAlien3 self.alien3 = dmd.AnimatedLayer(frames=anim.frames,hold=False,opaque=False,repeat=True,frame_time=6) self.alien3.composite_op = "blacksrc" self.alienLayers.append(self.alien3) # the small ship layer anim = self.game.assets.dmd_cvaSmallShip self.smallShip = dmd.AnimatedLayer(frames=anim.frames,hold=False,opaque=False,repeat=True,frame_time=6) ## lamps self.lamps = [self.game.lamps.badGuyL0, self.game.lamps.badGuyL1, self.game.lamps.badGuyL2, self.game.lamps.badGuyL3] self.finishing = False
def gunfight_intro_hard(self,badGuys): # put the last bad guy in the zero spot badGuys[0] = badGuys[3] print "Hard mode: Active Target is now: " +str(badGuys[0]) # set the display to the eyes anim = self.game.assets.dmd_gunfightEyes animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=True,repeat=False,frame_time=6) self.layer = animLayer # pick a random wait time between 1 and 4 seconds myWait = random.randrange(1,4,1) print "Hard Mode: wait time is " + str(myWait) # go to the draw after the delay self.delay("Operational",delay=myWait,handler=self.gunfight_intro_draw,param=badGuys)
def set_train_layer(self, type="idle", offset=0): # for switching betwen the three train layers if type == "idle": self.trainLayer = dmd.AnimatedLayer(frames=self.animIdle.frames, hold=False, opaque=False, repeat=True, frame_time=6) if type == "left": self.trainLayer = dmd.AnimatedLayer(frames=self.animLeft.frames, hold=True, opaque=False, repeat=False, frame_time=6) if type == "right": self.trainLayer = dmd.AnimatedLayer(frames=self.animRight.frames, hold=True, opaque=False, repeat=False, frame_time=6) # move the layer to the appropriate spot self.trainLayer.set_target_position(offset, 0) self.trainLayer.composite_op = "blacksrc"
def mode_started(self): # index for available shots self.liveShots = [] self.availableShots = [0, 1, 2, 3, 4, 5, 6, 7, 8] self.moonlightTotal = 0 self.running = True self.starting = True self.hd_flair = self.game.user_settings['Gameplay (Feature)'][ 'High Def Flair'] == 'Enabled' self.hd_banners = [] self.shuffle_hd_banners() self.tilted = False # kill the GI - and all the lights self.game.gi_control("OFF") self.game.lamp_control.disable_all_lamps() # pick a random shot to light to start with self.enable = 0 self.enable += self.shotsAtStart self.enable_shots() duration = self.game.sound.play(self.game.assets.sfx_churchBell) self.delay(delay=1, handler=self.game.sound.play, param=self.game.assets.sfx_mbHowl) # start the intro music self.delay(delay=duration - 1, handler=self.launch) # throw up an intro display anim = self.game.assets.dmd_moonIntro backdrop = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=True, repeat=False, frame_time=12) topLine = ep.EP_TextLayer(74, 5, self.game.assets.font_10px_AZ, "center", opaque=False).set_text("MOONLIGHT", color=ep.CYAN) topLine.composite_op = "blacksrc" bottomLine = ep.EP_TextLayer(74, 18, self.game.assets.font_10px_AZ, "center", opaque=False).set_text("MADNESS", color=ep.CYAN) bottomLine.composite_op = "blacksrc" combined = dmd.GroupedLayer(128, 32, [backdrop, topLine, bottomLine]) self.layer = combined self.delay("Display", delay=duration + 2, handler=self.update_display)
def gunfight_intro_hands(self,badGuys): # pop the second bad guy and remove it enemy = badGuys.pop(0) print "POP ENEMY: " + str(enemy) self.game.bad_guys.target_up(enemy) self.game.base.play_quote(self.game.assets.quote_gunfightReady) # play the second orchestra hit self.game.sound.play(self.game.assets.sfx_gunfightHit2) # show the hands animation anim = self.game.assets.dmd_gunfightHands myWait = len(anim.frames) / 10.0 animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=True,repeat=False,frame_time=6) self.layer = animLayer # after a delay pass to the feet with the pop order self.delay("Operational",delay=1.1,handler=self.gunfight_intro_boots,param=badGuys) self.delay("Operational",delay=1.1,handler=self.game.bad_guys.target_down,param=enemy)
def train_stage_two(self,score): self.awardString = "STOP TRAIN" self.awardPoints = str(ep.format_score(score)) self.game.score(score) self.game.base.play_quote(self.game.assets.quote_centerRamp2) self.game.sound.play(self.game.assets.sfx_trainChugShort) self.game.sound.play(self.game.assets.sfx_trainWhistle) anim = self.game.assets.dmd_trainRunning # math out the wait myWait = len(anim.frames) / 10.0 # set the animation animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=True,repeat=False,frame_time=6) # turn it on self.layer = animLayer # set the delay for the award self.delay("Display",delay=myWait,handler=self.show_award_text)
def gunfight_intro_eyes(self,badGuys): # pop up the first bad guy and remove it from the array enemy = badGuys.pop(0) print "POP ENEMY: " + str(enemy) self.game.bad_guys.target_up(enemy) # play the orchestra hit sound self.game.sound.play(self.game.assets.sfx_gunfightHit1) # show the eyes animation anim = self.game.assets.dmd_gunfightEyes myWait = len(anim.frames) / 10.0 animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=True,repeat=False,frame_time=6) self.layer = animLayer # after a delay pass to the hands with the pop order self.delay(name="Operational",delay=1.1,handler=self.gunfight_intro_hands,param=badGuys) # and drop the current one self.delay(delay=1.1,handler=self.game.bad_guys.target_down,param=enemy)
def play_ball_one_lock_anim(self,passive=False): self.cancel_delayed("Display") # quiet the music self.game.squelch_music() anim = self.game.assets.dmd_lockOne # calcuate the wait time to start the next part of the display myWait = len(anim.frames) / 10.0 # play the first sound self.game.sound.play(self.game.assets.sfx_ballOneLock) # set the animation animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=True,repeat=False,frame_time=6) # play the animation self.layer = animLayer self.lockedNumber = 1 self.delay("Lock Anim",delay=1,handler=self.game.base.play_quote,param=self.game.assets.quote_pollyHelp) self.delay("Display",delay=myWait,handler=self.lock_display_text)
def award_motherlode(self, times, overlay=None): # tick the counter up self.counter += 1 # tick the times down times -= 1 # setup the display awardTextTop = ep.EP_TextLayer(128 / 2, 5, self.game.assets.font_5px_bold_AZ, justify="center", opaque=True) awardTextTop.set_text( str(self.counter) + "X" + " = " + ep.format_score(self.displayMotherlodeValue * self.counter), color=ep.GREEN) motherLayer = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_motherlode.frames[0]) motherLayer.composite_op = "blacksrc" # if we're on the first counter, finish the wipe if self.counter == 1: # set up the second part of the wipe anim = self.game.assets.dmd_explosionWipe2 animLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=False, repeat=False, frame_time=6) animLayer.composite_op = "blacksrc" combined = dmd.GroupedLayer(128, 32, [awardTextTop, motherLayer, animLayer]) # otherwise just update the view else: combined = dmd.GroupedLayer(128, 32, [awardTextTop, motherLayer]) self.layer = combined # loop through the multiplier again if times is not zero if times == 0: # then go back to the main display self.delay(name="Display", delay=1.5, handler=self.main_display) # and kick the ball out self.game.mountain.kick() # false the bandits flag in case it's on self.bandits = False else: self.delay(delay=1, handler=self.award_motherlode, param=times)
def win_display(self,step=1): if step == 1: self.game.base.priority_quote(self.game.assets.quote_victory) # frame layer of the dead guy self.layer = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_ourHero.frames[0]) self.delay("Win Display",delay=0.5,handler=self.win_display,param=2) if step == 2: # the pan up anim = self.game.assets.dmd_ourHero # math out the wait myWait = len(anim.frames) / 60.0 # set the animation animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=False,repeat=False,frame_time=1) # turn it on self.layer = animLayer # loop back for the finish animation self.delay("Win Display",delay=myWait,handler=self.win_display,param=3) if step == 3: anim = self.game.assets.dmd_pollyVictory myWait = len(anim.frames) / 8.57 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold=True animLayer.frame_time = 7 animLayer.add_frame_listener(7,self.game.sound.play,param=self.game.assets.sfx_blow) animLayer.add_frame_listener(14,self.game.sound.play,param=self.game.assets.sfx_grinDing) # play animation self.layer = animLayer self.delay("Win Display",delay=myWait,handler=self.win_display,param=4) if step == 4: # saved banner goes here awardTextString = "POLLY SAVED BONUS" awardScoreString = str(ep.format_score(self.winBonus)) # combine them completeFrame = self.build_display(awardTextString,awardScoreString) stackLevel = self.game.show_tracking('stackLevel') # if something higher is running, throw the win display in a cut in if True in stackLevel[3:]: self.game.interrupter.cut_in(completeFrame,1) else: self.layer = completeFrame self.delay(name="Operational",delay=1.5,handler=self.end_bank_robbery) # show combo display if the chain is high enough if self.game.combos.chain > 1: self.delay(name="Display",delay=1.5,handler=self.game.combos.display)