def light_jackpot(self): # pick a jackpot thisOne = random.choice(self.availableJackpots) # take it out of the available and make it active self.availableJackpots.remove(thisOne) self.active.append(thisOne) print self.active # and update the lamps self.lamp_update() print "LIGHTING JACKPOT" anim = self.game.assets.dmd_dmb animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold=True animLayer.frame_time = 8 animLayer.composite_op = "blacksrc" animLayer.add_frame_listener(3,self.game.sound.play,param=self.game.assets.sfx_ebDrink) animLayer.add_frame_listener(5,self.game.sound.play,param=self.game.assets.sfx_ebDrink) animLayer.opaque=False words = self.game.assets.dmd_dmbJackpotAdded myWait = (len(words.frames) / 10.0) + 1 wordsLayer = ep.EP_AnimatedLayer(words) wordsLayer.add_frame_listener(6,self.game.sound.play,param=self.game.assets.sfx_orchestraSet) wordsLayer.hold=True wordsLayer.frame_time = 6 wordsLayer.opaque = True combined = dmd.GroupedLayer(128,32,[wordsLayer,animLayer]) self.cancel_delayed("Display") self.layer = combined self.delay(name="Display",delay=myWait,handler=self.update_display)
def collect_jackpot(self,shot,mode): # audit self.game.game_data['Feature']['Drunk MB Jackpots'] += 1 # take it out of active and put it in available # count the jackpots hit so far self.jackpot_count += 1 self.active.remove(shot) self.availableJackpots.append(shot) # update the lamps for the hit ramp mode('Disable') self.cancel_delayed("GI Reset") # flash some lights self.game.lamps.gi01.schedule(0xFF00FF00,cycle_seconds=1) self.game.lamps.gi02.schedule(0x0FF00FF0,cycle_seconds=1) self.game.lamps.gi03.schedule(0x00FF00FF,cycle_seconds=1) # turn the GI back on if not set for off if not self.giOff: self.delay("GI Reset",delay=1,handler=self.game.gi_control,param="ON") # score some points if self.jackpot_count == 5: self.game.score((self.jackpotValue * 2)) else: self.game.score(self.jackpotValue) self.jackpotEarned = self.jackpotValue self.jackpotValue += self.jackpotIncrement # load up the animation anim = self.game.assets.dmd_beerSlide # setup the animated layer beerLayer = ep.EP_AnimatedLayer(anim) beerLayer.hold=True beerLayer.frame_time = 3 beerLayer.composite_op = "blacksrc" anim = self.game.assets.dmd_dmbJackpot # setup the animated layer wordsLayer = ep.EP_AnimatedLayer(anim) wordsLayer.hold=True wordsLayer.frame_time = 3 wordsLayer.composite_op = "blacksrc" if self.layer == None: self.layer = self.no_layer() combined = dmd.GroupedLayer(128,32,[self.layer,wordsLayer,beerLayer]) self.cancel_delayed("Display") self.layer = combined self.game.sound.play(self.game.assets.sfx_slide) if self.jackpot_count == 5 and not self.game.gm_multiball.running: self.music_on(self.game.assets.music_fireball) else: self.game.base.play_quote(self.game.assets.quote_drunkJackpot) self.delay(name="Display",delay=1.5,handler=self.jackpot_score)
def intro(self, step=1): if step == 1: self.stop_music() anim = self.game.assets.dmd_cvIntro1 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 6 animLayer.repeat = False animLayer.opaque = True animLayer.composite_op = "blacksrc" animLayer.add_frame_listener(31, self.stop_music) self.layer = animLayer self.game.sound.play(self.game.assets.sfx_cvStartRiff) self.delay(delay=0.5, handler=self.music_on, param=self.game.assets.music_cvGear) self.delay(delay=0.5, handler=self.game.sound.play, param=self.game.assets.quote_cvIntroLead) self.delay(delay=0.5, handler=self.game.bart.animate, param=2) self.delay(delay=2.75, handler=self.intro, param=2) if step == 2: myDelay = self.game.sound.play(self.game.assets.quote_cvIntro) self.game.bart.animate(2) self.delay(delay=myDelay, handler=self.intro, param=3) if step == 3: # start the score updater self.score_update() anim = self.game.assets.dmd_cvIntro2 myWait = len(anim.frames) / 10.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 6 animLayer.repeat = False animLayer.opaque = False animLayer.composite_op = "blacksrc" # generate the backdrop mainLayer = self.display_main() self.layer = dmd.GroupedLayer(128, 32, [mainLayer, animLayer]) myDelay = self.game.sound.play(self.game.assets.sfx_cvMusicLead) self.delay(delay=myDelay, handler=self.music_on, param=self.game.assets.music_ringmaster) self.delay(delay=myWait, handler=self.intro, param=4) if step == 4: self.layer = self.display_main() self.get_going()
def mode_started(self): # fire up the switch block if it's not already loaded self.game.switch_blocker('add', self.myID) # unload the launcher self.game.tribute_launcher.unload() # first hit is 250, but it adds the bump first in the routine self.value = 175000 self.bump = 75000 self.running = True self.halted = False # overall mode timer self.modeTimer = 20 # total ringmaster hits self.hitsSoFar = 0 # score for the mode self.totalPoints = 0 # create the hypno backdrop level anim = self.game.assets.dmd_cvHypno self.hypnoLayer = ep.EP_AnimatedLayer(anim) self.hypnoLayer.hold = False self.hypnoLayer.frame_time = 6 self.hypnoLayer.repeat = True self.hypnoLayer.opaque = True self.won = False self.switchHit = False self.intro()
def play_ball_two_lock_anim(self): self.cancel_delayed("Display") # quiet the music self.game.squelch_music() anim = self.game.assets.dmd_lockTwo # calcuate the wait time to start the next part of the display myWait = len(anim.frames) / 10.0 # set the animation animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 6 animLayer.opaque = True # keyframe some sounds animLayer.add_frame_listener(2, self.game.base.play_quote, param=self.game.assets.quote_gasp) animLayer.add_frame_listener( 15, self.game.sound.play, param=self.game.assets.sfx_lockTwoMinecart) animLayer.add_frame_listener( 32, self.game.sound.play, param=self.game.assets.sfx_lockTwoExplosion) animLayer.add_frame_listener(32, self.game.base.red_flasher_flourish) # play the animation self.layer = animLayer self.lockedNumber = 2 self.delay("Display", delay=myWait, handler=self.lock_display_text, param=self.lockedNumber)
def new_rack(self): self.racking = True # kill the GI again self.game.gi_control("OFF") # play the interstitial animation # load up the lightning anim = self.game.assets.dmd_cloudLightning # math out the wait myWait = len(anim.frames) / 10.0 # set the animation anim_layer = ep.EP_AnimatedLayer(anim) anim_layer.hold = True anim_layer.frame_time = 6 # keyframe sounds anim_layer.add_frame_listener(2, self.game.sound.play, param=self.game.assets.sfx_lightning1) anim_layer.add_frame_listener(2, self.game.lightning, param="top") anim_layer.add_frame_listener(3, self.game.lightning, param="left") anim_layer.add_frame_listener(3, self.game.lightning, param="right") anim_layer.add_frame_listener(6, self.game.sound.play, param=self.game.assets.sfx_lightning2) anim_layer.add_frame_listener(6, self.game.lightning, param="top") anim_layer.add_frame_listener(7, self.game.lightning, param="left") anim_layer.add_frame_listener( 10, self.game.sound.play, param=self.game.assets.sfx_lightningRumble) anim_layer.add_frame_listener(10, self.game.lightning, param="top") anim_layer.add_frame_listener(11, self.game.lightning, param="right") # turn it on self.layer = anim_layer self.delay("Operational", delay=myWait, handler=self.new_rack_pan)
def increase(self): # cancel the "Clear" delay if there is one self.abort_display() # play the cactus mashing animation anim = self.game.assets.dmd_bonusCactus # calculate the wait for displaying the text myWait = (len(anim.frames) / 8.57) - 0.4 # set the animation animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 7 animLayer.opaque = True animLayer.add_frame_listener(2,self.game.sound.play,param=self.game.assets.sfx_cactusMash) animLayer.add_frame_listener(4,self.game.base.red_flasher_flourish) # run the animation self.layer = animLayer # increase the bonus if we're not limited if self.limited and self.game.show_tracking('bonusX') == self.max: pass else: self.game.increase_tracking('bonusX') # turn both lights off self.game.set_tracking('bonusLaneStatus',"OFF",0) self.game.set_tracking('bonusLaneStatus',"OFF",1) self.delay(delay=1,handler=self.game.lamp_control.bonus_lanes,param=True) # after the delay, show the award self.delay(name="Display",delay=myWait,handler=self.show_bonus_award)
def start_highNoon(self,step=1): if step == 1: # audit self.game.game_data['Feature']['High Noon Started'] += 1 # turn off ball search because this takes a while self.game.ball_search.disable() # kill the music self.stop_music() # turn off the lights self.game.set_tracking('lampStatus', "OFF") self.lamp_update() self.game.stack_level(6,True) self.game.set_tracking('highNoonStatus',"RUNNING") self.running = True # church bell anim = self.game.assets.dmd_bellTower myWait = len(anim.frames) / 10.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 6 # ding the bell on frame 5 animLayer.add_frame_listener(5,self.church_bell,param=12) self.layer = animLayer # loop back to step 2 self.delay(delay=myWait,handler=self.start_highNoon,param = 2) if step == 2: # show a 'high noon' banner or animation self.banner = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_highNoon.frames[0]) self.layer = self.banner # play the opening quote duration = self.game.base.play_quote(self.game.assets.quote_highNoon) # after the quote, start the intro self.delay(delay=duration,handler=self.intro)
def tumbleweed_display(self, value, combo): banner = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_tumbleweedBanner.frames[0]) scoreLayer = ep.EP_TextLayer(64, 22, self.game.assets.font_9px_az, justify="center", opaque=False).set_text(str( ep.format_score(value)), blink_frames=6, color=ep.YELLOW) # load up the animation anim = self.game.assets.dmd_tumbleweedRight # start the full on animation myWait = len(anim.frames) / 15.0 + 0.5 # setup the animated layer animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 4 animLayer.opaque = False animLayer.composite_op = "blacksrc" combined = dmd.GroupedLayer(128, 32, [banner, scoreLayer, animLayer]) self.layer = combined self.game.sound.play(self.game.assets.sfx_tumbleWind) self.delay(name="Display", delay=myWait, handler=self.clear_layer) if combo: self.delay(name="Display", delay=myWait, handler=self.game.combos.display)
def finish_up(self): # cancel the main display loop self.cancel_delayed("Display") # reset the autoplunge, just in case self.game.trough.balls_to_autoplunge = 0 # turn off the local running flag self.running = False self.game.set_tracking('highNoonStatus',"FINISH") # drop the bad guys self.game.bad_guys.drop_targets() # turn the lights off self.game.set_tracking('lampStatus',"OFF") self.lamp_update() # kill the bad guy lamps? for lamp in range(0,4,1): self.game.lamp_control.badGuyLamps[lamp].disable() # kill the GI self.game.gi_control("OFF") # lampshow down wipe self.game.lampctrl.play_show(self.game.assets.lamp_topToBottom, repeat=False) # throw in a 'you won' display if self.hasWon: # fireworks anim = self.game.assets.dmd_fireworks myWait = len(anim.frames) / 10.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 6 # firework sounds keyframed animLayer.add_frame_listener(7,self.game.sound.play,param=self.game.assets.sfx_fireworks1) animLayer.add_frame_listener(14,self.game.sound.play,param=self.game.assets.sfx_fireworks2) animLayer.add_frame_listener(20,self.game.sound.play,param=self.game.assets.sfx_fireworks3) animLayer.composite_op = "blacksrc" textLayer1 = ep.EP_TextLayer(64, 3, self.game.assets.font_9px_az, "center", opaque=False).set_text("VICTORY",color=ep.GREEN) textLayer2 = ep.EP_TextLayer(64, 13, self.game.assets.font_13px_score, "center", opaque=False).set_text(str(ep.format_score(self.victoryPoints + self.timeBonus)),color=ep.ORANGE) combined = dmd.GroupedLayer(128,32,[textLayer1,textLayer2,animLayer]) self.layer = combined else: myWait = 3 textLayer1 = ep.EP_TextLayer(64,4,self.game.assets.font_10px_AZ, "center", opaque=True).set_text("THEY",color=ep.RED) textLayer2 = ep.EP_TextLayer(64,18,self.game.assets.font_10px_AZ, "center", opaque=False).set_text("ESCAPED",color=ep.RED) combined = dmd.GroupedLayer(128,32,[textLayer1,textLayer2]) self.layer = combined # turn the flippers off self.game.enable_flippers(False) # clear the saloon and mine if needed if self.game.switches.minePopper.is_active(): self.game.mountain.kick() if self.game.switches.saloonPopper.is_active(): self.game.saloon.kick() # clear the shooter lane if needed if self.game.switches.shooterLane.is_active(): self.game.coils.autoPlunger.pulse(self.game.base.autoplungeStrength) if self.hasWon: # if we won, the animation is playing, so it may take a while and the balls may drain first # so we have to bounce through a helper self.delay(delay=myWait+1,handler=self.final_display_pause) else: # loop through final display which checks for balls on the field self.final_display_pause()
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 intro_animation(self): # load up the animation anim = self.game.assets.dmd_multiballStart # math out how long it is in play time myWait = len(anim.frames) / 10.0 # setup the animated layer animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 6 animLayer.opaque = True animLayer.add_frame_listener(12, self.game.base.priority_quote, param=self.game.assets.quote_gold) animLayer.add_frame_listener(24, self.game.base.priority_quote, param=self.game.assets.quote_mine) animLayer.add_frame_listener(34, self.ta_da) animLayer.add_frame_listener(43, self.game.sound.play, param=self.game.assets.sfx_smashingWood) # turn it on self.layer = animLayer # start the lampshow self.game.lampctrl.play_show(self.game.assets.lamp_gmStart, repeat=False, callback=self.reset_lamps) # when the animation is over go to the next step self.delay(delay=myWait, handler=self.intro_banner)
def ball_saved(self): # don't show in certain situations if self.game.drunk_multiball.running or \ self.game.moonlight.running or \ self.game.marshall_multiball.running or \ self.game.gm_multiball.running or \ self.game.stampede.running or \ self.game.cva.running or \ self.game.last_call.running: return # otherwise, party on # play a quote self.game.base.priority_quote(self.game.assets.quote_dontMove) # show some display anim = self.game.assets.dmd_ballSaved myWait = len(anim.frames) / 12.0 # set the animation animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 5 animLayer.opaque = True # add listener frames animLayer.add_frame_listener(2, self.game.sound.play, param=self.game.assets.sfx_ballSaved) self.cancel_delayed("Display") self.layer = animLayer self.delay(delay=myWait + 0.5, handler=self.clear_layer)
def teleport_aliens(self,wave): # a bunch of bother just to make it so that the aliens don't come up the exact same every time print "TELEPORT DIRECTION - " + str(self.direction[0]) if wave == 1: if self.direction[0] == "LEFT": aliens = ["Zero","Two"] else: aliens = ["One","Three"] else: if self.direction[0] == "LEFT": aliens = ["One","Three"] else: aliens = ["Zero","Two"] anim = self.game.assets.dmd_cvaTeleport myWait = len(anim.frames) / 10.0 # setup the first teleporting alien teleport1 = ep.EP_AnimatedLayer(anim) teleport1.hold=True teleport1.frame_time = 6 teleport1.composite_op = "blacksrc" # setup the second teleporting layer teleport2 = ep.EP_AnimatedLayer(anim) teleport2.hold=True teleport2.frame_time = 6 teleport2.composite_op = "blacksrc" # adjust their positions if aliens[0] == "Zero": print "ALIEN 0 - " + str(aliens[0]) teleport1.set_target_position(-4,0) else: print "ALIEN 0 - " + str(aliens[0]) teleport1.set_target_position(28,0) if aliens[1] == "Two": teleport2.set_target_position(60,0) else: teleport2.set_target_position(92,0) # add them to the list self.teleportingAliens.append(teleport1) self.teleportingAliens.append(teleport2) # turn on the display flag self.teleporting = True # update the display self.update_display() duration = self.game.sound.play(self.game.assets.sfx_cvaTeleport) self.delay(delay = duration,handler=self.game.base.play_quote,param=self.game.assets.quote_cvaTeleported) # delay the actual activation of the targets self.delay("Aliens",delay=myWait,handler=self.activate_aliens,param=aliens)
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 jackpot_shot(self, double=False): # score points if double: points = self.shotValue * 2 self.showDub = True else: points = self.shotValue self.showDub = False self.score(points) # play a quote self.game.base.priority_quote(self.game.assets.quote_jackpot) # flash some lights self.game.base.red_flasher_flourish() # do a display # load up the animation anim = self.game.assets.dmd_beerSlide # setup the animated layer beerLayer = ep.EP_AnimatedLayer(anim) beerLayer.hold = True beerLayer.frame_time = 3 beerLayer.composite_op = "blacksrc" anim = self.game.assets.dmd_dmbJackpot # setup the animated layer wordsLayer = ep.EP_AnimatedLayer(anim) wordsLayer.hold = True wordsLayer.frame_time = 3 wordsLayer.composite_op = "blacksrc" if self.layer == None: self.layer = self.no_layer() combined = dmd.GroupedLayer(128, 32, [self.layer, wordsLayer, beerLayer]) self.cancel_delayed("Display") self.layer = combined self.game.sound.play(self.game.assets.sfx_slide) self.delay(name="Display", delay=1.5, handler=self.jackpot_score, param=points) # enable the double jackpot shot self.enable_double()
def static_to_ship(self): # transition to the ship anim = self.game.assets.dmd_cvaShipBehindStatic myWait = len(anim.frames) / 10.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold=False animLayer.repeat = True animLayer.frame_time = 6 self.staticShip = animLayer self.transition = ep.EP_Transition(self,self.staticLayer,animLayer,ep.EP_Transition.TYPE_CROSSFADE,callback=self.one_beat)
def finish_frogs(self,step=1): if step == 1: # kill the delays self.wipe_delays() # stop the music self.stop_music() anim = self.game.assets.dmd_ssBubbles myWait = len(anim.frames) / 10.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = False animLayer.frame_time = 6 animLayer.repeat = True animLayer.opaque = False animLayer.composite_op = "blacksrc" textLayer1 = ep.EP_TextLayer(64,2,self.game.assets.font_5px_AZ,"center",opaque=False).set_text("LEAPER TOTAL",color=ep.GREEN) textLayer2 = ep.EP_TextLayer(64,11,self.game.assets.font_9px_az,"center",opaque=False).set_text(str(ep.format_score(self.totalPoints)),color=ep.RED) combined = dmd.GroupedLayer(128,32,[textLayer1,textLayer2,animLayer]) self.layer = combined # play a final quote if len(self.availFrogs) == 0: self.delay(delay=0.3,handler=self.game.sound.play,param=self.game.assets.quote_ssWin) else: self.delay(delay=0.3,handler=self.game.sound.play,param=self.game.assets.quote_ssLose) self.game.sound.play(self.game.assets.sfx_ssBubbling) self.game.sound.play(self.game.assets.sfx_ssGong) self.delay(delay=1.5,handler=self.finish_frogs,param=2) if step == 2: # do the pop anim = self.game.assets.dmd_ssPop myWait = len(anim.frames) / 10.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 6 animLayer.repeat = False animLayer.opaque = False animLayer.composite_op = "blacksrc" animLayer.add_frame_listener(6,self.game.sound.play,param=self.game.assets.sfx_ssPop) textLayer1 = ep.EP_TextLayer(64,2,self.game.assets.font_5px_AZ,"center",opaque=False).set_text("LEAPER TOTAL",color=ep.GREEN) textLayer2 = ep.EP_TextLayer(64,11,self.game.assets.font_9px_az,"center",opaque=False).set_text(str(ep.format_score(self.totalPoints)),color=ep.RED) combined = dmd.GroupedLayer(128,32,[textLayer1,textLayer2,animLayer]) self.layer = combined self.delay(delay=1.5,handler=self.done)
def collect_extra_ball(self,type=0): self.cancel_delayed("Display") # stop the music self.game.squelch_music() # turn off the mine flasher ? # add one to the total of extra balls ebt = self.game.increase_tracking('extraBallsTotal') print "Extra balls total: " + str(ebt) # take one off of the pending total self.game.decrease_tracking('extraBallsPending') self.lamp_update() # add one to the pending the player for use - using the framework standard for storing extra_balls self.game.current_player().extra_balls += 1 # if they've already gotten an extra ball - it should divert to the short version # or if anything above stack level 1 is running stack = self.game.show_tracking('stackLevel') if self.game.current_player().extra_balls > 1 or True in stack[1:] or self.game.show_tracking('bozoBall') or type == 1: # play the short one self.extra_ball_ending(isLong=False) # otherwise play the whole animation else: # set the flag here for being able to abort self.collectingEB = True # load up the animation anim = self.game.assets.dmd_extraBall # start the full on animation myWait = len(anim.frames) / 7.50 # setup the animated layer animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold=True animLayer.frame_time = 8 animLayer.opaque = True # keyframe a bunch of sounds animLayer.add_frame_listener(13,self.game.sound.play,param=self.game.assets.sfx_ebDrink) animLayer.add_frame_listener(15,self.game.sound.play,param=self.game.assets.sfx_ebDrink) animLayer.add_frame_listener(17,self.game.sound.play,param=self.game.assets.sfx_ebDrink) animLayer.add_frame_listener(23,self.game.base.play_quote,param=self.game.assets.quote_whatThe) animLayer.add_frame_listener(25,self.game.sound.play,param=self.game.assets.sfx_ebGunfire) animLayer.add_frame_listener(25,lambda: self.game.lampctrl.play_show(self.game.assets.lamp_sparkle, repeat=False,callback=self.game.lamp_control.feature_lamps_on)) animLayer.add_frame_listener(41,self.game.sound.play,param=self.game.assets.sfx_ebLookRight) animLayer.add_frame_listener(45,self.game.sound.play,param=self.game.assets.sfx_ebLookLeft) animLayer.add_frame_listener(46,self.game.sound.play,param=self.game.assets.sfx_ebFallAndCrash) animLayer.add_frame_listener(46,lambda: self.game.lampctrl.play_show(self.game.assets.lamp_wipeToBottom, repeat=False,callback=self.lamp_update)) # play the intro sounds self.game.sound.play(self.game.assets.sfx_ebMusic) self.game.base.play_quote(self.game.assets.quote_thirsty) # turn that sucker on self.layer = animLayer # after a delay, play the ending self.delay("Collecting",delay=myWait,handler=self.extra_ball_ending) # update lamps to turn on the EB light self.lamp_update()
def hit_ringmaster(self): print "Hit Ringmaster" # stop the timer self.cancel_delayed("Mode Timer") # stop the movement for now self.cancel_delayed("Move Timer") # on a hit, increase the value, and add the new value to the total and display the hit self.value += self.bump # score the points self.game.score(self.value) self.totalPoints += self.value # register the hit self.hitsSoFar += 1 remain = self.hitsToWin - self.hitsSoFar if remain <= 0 and not self.won: # flag so this only happens once self.won = True # end this sucker self.infoLine.set_text("}}}}", color=ep.MAGENTA) self.finish_ringmaster() elif remain == 1: self.infoLine.set_text("}}}{", color=ep.MAGENTA) elif remain == 2: self.infoLine.set_text("}}{{", color=ep.MAGENTA) elif remain == 3: self.infoLine.set_text("}{{{", color=ep.MAGENTA) else: pass self.titleLine.set_text(ep.format_score(self.value), color=ep.CYAN) self.modeTimer = 21 # display the hit anim = random.choice(self.hitLayers) myWait = len(anim.frames) / 10.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 6 animLayer.repeat = False animLayer.opaque = False animLayer.composite_op = "blacksrc" mainLayer = self.display_main() self.layer = dmd.GroupedLayer(128, 32, [mainLayer, animLayer]) # play the hit sound myWait = self.game.sound.play(self.game.assets.sfx_cvHit) self.delay(delay=0.5, handler=self.game.base.priority_quote, param=self.game.assets.quote_cvHit) self.delay(delay=0.5, handler=self.game.bart.animate, param=2) self.delay(delay=1, handler=self.post_hit)
def shoot_again(self, step=1): # shown when starting an extra ball if step == 1: imageLayer = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_shootAgain.frames[0]) self.game.base.play_quote(self.game.assets.quote_deepLaugh) self.game.sound.play(self.game.assets.sfx_incoming) self.layer = imageLayer self.delay(delay=2, handler=self.shoot_again, param=2) if step == 2: anim = self.game.assets.dmd_shootAgain # math out the wait myWait = len(anim.frames) / 10.0 # set the animation animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 6 animLayer.opaque = True animLayer.add_frame_listener(2, self.game.sound.play, param=self.game.assets.sfx_lowBoom) #animLayer.add_frame_listener(4,self.game.trough.launch_balls,param=1) # this flag tells the player intro quote to not play self.hush = True animLayer.add_frame_listener(4, self.game.ball_starting) self.layer = animLayer self.delay(delay=myWait, handler=self.shoot_again, param=3) if step == 3: imageLayer = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_shootAgain.frames[7]) self.play_ordered_quote(self.game.assets.quote_shootAgain, 'shoot_again') textLine1 = ep.EP_TextLayer(80, 5, self.game.assets.font_9px_az, "center", opaque=False).set_text("SHOOT", color=ep.GREEN) textLine2 = ep.EP_TextLayer(80, 15, self.game.assets.font_9px_az, "center", opaque=False).set_text("AGAIN", color=ep.GREEN) combined = dmd.GroupedLayer(128, 32, [imageLayer, textLine1, textLine2]) self.layer = combined self.delay(delay=1.5, handler=self.clear_layer)
def saloon_hit(self): print "Saloon hit" if not self.ending: print "not ending" # cancel the display loop self.cancel_delayed("Display") # display a thing about jackpots resetting anim = self.game.assets.dmd_beerFill beerLayer = ep.EP_AnimatedLayer(anim) beerLayer.hold = True beerLayer.repeat = False beerLayer.frame_time = 8 beerLayer.opaque = True textLayer1 = ep.EP_TextLayer(51, 2, self.game.assets.font_9px_az, "center", opaque=False).set_text("ANOTHER", color=ep.RED) textLayer2 = ep.EP_TextLayer(51, 12, self.game.assets.font_9px_az, "center", opaque=False).set_text("ROUND", color=ep.RED) textLayer3 = ep.EP_TextLayer(51, 24, self.game.assets.font_5px_AZ, "center", opaque=False).set_text( "JACKPOTS RESET", blink_frames=8, color=ep.RED) combined = dmd.GroupedLayer( 128, 32, [beerLayer, textLayer1, textLayer2, textLayer3]) self.layer = combined self.game.sound.play(self.game.assets.sfx_pour) # reset the value self.shotValue = self.startValue # kick the ball self.game.saloon.kick() # back to the main display in 2 seconds self.delay("Display", delay=2, handler=self.main_display) if self.ending: self.game.saloon.kick()
def dude_shoots(self): # bail if no bad guys remain if True not in self.isActive: return # get the available bad guys into a list dudes = [] if self.isActive[0]: dudes.append(0) if self.isActive[1]: dudes.append(1) if self.isActive[2]: dudes.append(2) print "DUDES:" print dudes # pick a random guy to shoot self.shooter = random.choice(dudes) print "THE SHOOTER IS: " + str(self.shooter) # load the animation anim = self.game.assets.dmd_bankDude # math out the wait self.shotWait = len(anim.frames) / 10.0 # the shoots back animation eGuy0 = ep.EP_AnimatedLayer(anim) eGuy0.hold = True eGuy0.frame_time = 6 eGuy0.composite_op = "blacksrc" eGuy0.add_frame_listener(2, self.game.sound.play, param=self.game.assets.sfx_explosion11) eGuy0.add_frame_listener(2, self.game.base.flash, param=self.flashers[self.shooter]) eGuy0.add_frame_listener(4, self.game.sound.play, param=self.game.assets.sfx_explosion11) eGuy0.add_frame_listener(4, self.game.base.flash, param=self.flashers[self.shooter]) # set the position of the layer based on choice eGuy0.set_target_position(self.position[self.shooter], self.y_pos) # assign the layer to the positon of the shooter if self.shooter == 0: self.dude0Layer = eGuy0 elif self.shooter == 1: self.dude1Layer = eGuy0 elif self.shooter == 2: self.dude2Layer = eGuy0 # set a flag self.shooting = True
def replay_award_display(self): anim = self.game.assets.dmd_fireworks myWait = (len(anim.frames) / 10.0) + 1 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 6 # firework sounds keyframed animLayer.add_frame_listener(14, self.game.sound.play, param=self.game.assets.sfx_fireworks1) animLayer.add_frame_listener(17, self.game.sound.play, param=self.game.assets.sfx_fireworks2) animLayer.add_frame_listener(21, self.game.sound.play, param=self.game.assets.sfx_fireworks3) animLayer.add_frame_listener(24, self.game.sound.play, param=self.game.assets.quote_replay) animLayer.composite_op = "blacksrc" textLine1 = "REPLAY AWARD" textLayer1 = ep.EP_TextLayer(58, 5, self.game.assets.font_10px_AZ, "center", opaque=True).set_text(textLine1, color=ep.BLUE) textLayer1.composite_op = "blacksrc" textLine2 = self.game.user_settings['Machine (Standard)'][ 'Replay Award'] if textLine2.upper == "EXTRA BALL" and self.game.max_extra_balls_reached( ): textLine2 = ep.format_score(500000) textLayer2 = dmd.TextLayer(58, 18, self.game.assets.font_10px_AZ, "center", opaque=False).set_text(textLine2.upper()) textLayer2.composite_op = "blacksrc" combined = dmd.GroupedLayer(128, 32, [textLayer1, textLayer2, animLayer]) self.layer = combined self.delay(delay=myWait, handler=self.game.sound.play, param=self.game.assets.sfx_cheers) self.delay("Display", delay=myWait, handler=self.clear_layer)
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)
def start_showdown(self, side): print "S H O W D O W N" # turn on the display hold to catch ball drain during intro self.game.display_hold = True # audits self.game.game_data['Feature']['Showdown Started'] += 1 # raise the post to hold the ball self.activeSide = side # set the layer tracking self.game.stack_level(1, True) # set the showdown tracking self.game.set_tracking('showdownStatus', "RUNNING") # kill the GI self.game.gi_control("OFF") # things, they go here self.death_tally = 0 # kick out more ball # pop up the targets # play a startup animation anim = self.game.assets.dmd_showdown myWait = len(anim.frames) / 10.0 anim_layer = ep.EP_AnimatedLayer(anim) anim_layer.hold = True anim_layer.frame_time = 6 # keyframe sounds anim_layer.add_frame_listener(2, self.game.sound.play, param=self.game.assets.sfx_lightning1) anim_layer.add_frame_listener(2, self.game.lightning, param="top") anim_layer.add_frame_listener(4, self.game.lightning, param="top") anim_layer.add_frame_listener(5, self.game.lightning, param="left") anim_layer.add_frame_listener( 8, self.game.sound.play, param=self.game.assets.sfx_lightningRumble) anim_layer.add_frame_listener(8, self.game.lightning, param="top") anim_layer.add_frame_listener(10, self.game.lightning, param="top") anim_layer.add_frame_listener(11, self.game.lightning, param="left") # setup the display self.layer = anim_layer # If the multiball ball savers are a thing, do that self.game.base.multiball_saver() self.delay("Operational", delay=myWait, handler=self.get_going) self.taunt_timer()
def run_animation(self): # run the animation with sound # load up the animation anim = self.game.assets.dmd_match # start the full on animation myWait = len(anim.frames) / 7.5 + 0.5 # setup the animated layer animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 8 animLayer.composite_op = "blacksrc" combined = dmd.GroupedLayer(128, 32, [ self.digitLayer, self.zeroLayer, self.p1Layer, self.p2Layer, self.p3Layer, self.p4Layer, animLayer ]) # fire it up self.layer = combined self.fire("LEFT") self.delay(delay=0.125, handler=self.game.sound.play, param=self.game.assets.sfx_breakingGlass1) self.delay(delay=0.5, handler=self.fire, param="RIGHT") self.delay(delay=0.625, handler=self.game.sound.play, param=self.game.assets.sfx_breakingGlass1) self.delay(delay=1, handler=self.fire, param="LEFT") self.delay(delay=1.125, handler=self.game.sound.play, param=self.game.assets.sfx_breakingGlass1) self.delay(delay=1.125, handler=self.fire, param="RIGHT") self.delay(delay=1.250, handler=self.game.sound.play, param=self.game.assets.sfx_breakingGlass1) self.delay(delay=1.625, handler=self.fire, param="LEFT") self.delay(delay=1.75, handler=self.game.sound.play, param=self.game.assets.sfx_breakingGlass1) self.delay(delay=1.75, handler=self.fire, param="RIGHT") self.delay(delay=1.875, handler=self.game.sound.play, param=self.game.assets.sfx_breakingGlass1) # after the animation ends, see if anybody won and run that action self.delay(delay=myWait, handler=self.award_match)
def start_ambush(self, side): # raise the post to hold the ball self.activeSide = side #self.posts[self.activeSide].patter(on_time=2,off_time=6,original_on_time=30) print "A M B U S H" # audit self.game.game_data['Feature']['Ambush Started'] += 1 # kill the music self.stop_music() # set the layer tracking self.game.stack_level(1, True) # set the showdown tracking self.game.set_tracking('ambushStatus', "RUNNING") # kill the GI self.game.gi_control("OFF") # turn off the bad guy lights self.game.lamp_control.disable_bad_guys() # things, they go here self.deathTally = 0 # play a startup animation anim = self.game.assets.dmd_ambush myWait = len(anim.frames) / 10.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 6 # keyframe sounds animLayer.add_frame_listener(2, self.game.sound.play, param=self.game.assets.sfx_lightning1) animLayer.add_frame_listener(2, self.lightning, param="top") animLayer.add_frame_listener(4, self.lightning, param="top") animLayer.add_frame_listener(5, self.lightning, param="left") animLayer.add_frame_listener( 8, self.game.sound.play, param=self.game.assets.sfx_lightningRumble) animLayer.add_frame_listener(8, self.lightning, param="top") animLayer.add_frame_listener(10, self.lightning, param="top") animLayer.add_frame_listener(11, self.lightning, param="left") # setup the display self.layer = animLayer self.delay("Ambush", delay=myWait, handler=self.intro_quote)
def banner(self): # set a starting flag self.starting = True # setup the pour mask # load up the animation anim = self.game.assets.dmd_pourMask # setup the animated layer pour = ep.EP_AnimatedLayer(anim) pour.hold=True pour.frame_time = 6 pour.composite_op = "blacksrc" mug = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_beerMug1.frames[0]) mug.composite_op = "blacksrc" words = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_drunkMultiball.frames[0]) combined = dmd.GroupedLayer(128,32,[words,pour,mug]) self.layer = combined self.game.sound.play(self.game.assets.sfx_pour) self.delay("Operational",delay=1.3,handler=self.bannerTwo)
def hit_alien(self,target): if target in self.activeAliens: # audit self.game.game_data['Feature']['CVA Aliens Hit'] += 1 # flasher flourish self.game.base.red_flasher_flourish() # cancel the display self.cancel_delayed("Display") # remove the dead alien print "REMOVE ALIEN - " + str(target) self.activeAliens.remove(target) # count the kill self.aliensKilled += 1 # and count it for the round self.aliensKilledRound += 1 # do the display of the dying anim = self.game.assets.dmd_cvaShot myWait = len(anim.frames) / 10.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold=True animLayer.frame_time = 6 animLayer.composite_op = "blacksrc" myString = self.point_value("ALIEN") self.game.score(myString) # add the points to the running total self.alienPoints += myString titleLayer = ep.EP_TextLayer(64, 4, self.game.assets.font_7px_az, "center", opaque=False).set_text("ALIEN KILLED",color=ep.GREEN) scoreLayer = ep.pulse_text(self,64,14,ep.format_score(myString),align="center",myOpaque=True,size="12px",timing=0.1,color=ep.RED) combined = dmd.GroupedLayer(128,32,[scoreLayer,titleLayer,animLayer]) self.layer = combined self.delay(delay=0.5,handler=self.game.sound.play,param=self.game.assets.sfx_cvaGroan) self.game.sound.play(self.game.assets.sfx_cvaAlienHit) # delay the normal display and next saucer theDelay = myWait + 1.5 # if all 4 are dead, we change modes to the ship if self.aliensKilledRound == 4: self.delay(delay=theDelay,handler=self.switch_modes,param="SHIP") elif self.aliensKilledRound == 2: print "WAVE 2 NOW" self.delay("Aliens",delay=theDelay,handler=self.teleport_aliens,param=2) else: self.delay("Display",delay=theDelay,handler=self.update_display)