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 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 intro_transition(self): prizeDisplay = self.generate_layer() ep.EP_Transition(self, self.layer, prizeDisplay, ep.EP_Transition.TYPE_WIPE, ep.EP_Transition.PARAM_SOUTH, callback=self.update_layer)
def push_out(self): print "TRANSITION MF" blank = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_blank.frames[0]) blank.composite_op = "blacksrc" transition = ep.EP_Transition(self, self.layer, blank, ep.EP_Transition.TYPE_PUSH, ep.EP_Transition.PARAM_WEST) transition.callback = self.clear_layer
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 activate(self): # set up all the strings & quotes self.setup() # show the 'challenges you' display # clear the banner layer textLayer1 = ep.EP_TextLayer(40, 2, self.game.assets.font_7px_bold_az, justify="center", opaque=False) textLayer1.set_text(self.nameLine, color=ep.BROWN) textLayer2 = ep.EP_TextLayer(40, 15, self.game.assets.font_7px_bold_az, justify="center", opaque=False) textLayer2.set_text("CHALLENGES", color=ep.RED) textLayer3 = ep.EP_TextLayer(40, 23, self.game.assets.font_7px_bold_az, justify="center", opaque=False) textLayer3.set_text("YOU", color=ep.RED) textLayer = dmd.GroupedLayer( 128, 32, [self.faceFrame, textLayer1, textLayer2, textLayer3]) # play the intro duration = self.game.base.play_quote(self.introQuote, squelch=True) # wiggle the figure self.animate(2) # show the transition transition = ep.EP_Transition(self, self.game.score_display.layer, textLayer, ep.EP_Transition.TYPE_PUSH, ep.EP_Transition.PARAM_NORTH) # divert here if we're on boss bart if self.brother == 'BOSS': self.bossFight = True # bump up the points self.hitValue *= 2 self.defeatValue *= 2 self.deathTally = 0 # activate the drop targets self.delay(delay=duration, handler=self.game.bad_guys.setup_targets) # set them all to true self.activeBossPosse = [0, 1, 2, 3] else: # if there's only 1 hit to defeat this bart, set the status to last if self.hitsThisBart == 1: self.game.set_tracking('bartStatus', "LAST") self.delay("Display", delay=duration, handler=self.clear_layer) self.delay(delay=duration, handler=self.game.saloon.unbusy)
def pause_train(self, advanced=False): if self.running: print "PAUSE TRAIN" self.paused = True # kill the in progress timer self.cancel_delayed("Mode Timer") # stop the train from moving self.game.train.stop() # if the thing that sent us here advanced save polly, we pause for 3 seconds time = 0 if advanced: time = 3 # if we're not advancing, there's more to do if not advanced: time = 5 # play the pause display self.delay("Operational", delay=1.5, handler=self.game.sound.play, param=self.cows[0]) # swap for the next shot self.cows.reverse() # setup the display border = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_tracksBorder.frames[0]) awardTextTop = ep.EP_TextLayer( 128 / 2, 5, self.game.assets.font_5px_bold_AZ, justify="center", opaque=False) awardTextBottom = ep.EP_TextLayer( 128 / 2, 11, self.game.assets.font_15px_az, justify="center", opaque=False) awardTextTop.set_text("TRAIN", color=ep.BROWN) awardTextBottom.set_text("PAUSED", blink_frames=12, color=ep.GREEN) completeFrame = dmd.GroupedLayer( 128, 32, [border, awardTextTop, awardTextBottom]) transition = ep.EP_Transition(self, self.layer, completeFrame, ep.EP_Transition.TYPE_PUSH, ep.EP_Transition.PARAM_NORTH) # set a delay to start the train again self.delay("Pause Timer", delay=1.5, handler=self.pause_timer, param=time)
def hit_banner(self): print "HIT BANNER GOES HERE" # turn off the banner flag self.banner = False # cancel the mode timer during the display self.cancel_delayed("Mode Timer") shotsLeftText = str(self.shotsToWin - self.shotsSoFar) + " MORE TO GO" display = self.build_display(shotsLeftText, str(ep.format_score(self.lastPoints))) transition = ep.EP_Transition(self, self.layer, display, ep.EP_Transition.TYPE_CROSSFADE) self.delay("Display", delay=1.5, handler=self.in_progress)
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 start_river_chase(self, step=1): if step == 1: # audit self.game.game_data['Feature']['Left Polly Started'] += 1 # set the level 1 stack flag self.game.stack_level(2, True) # set the running flag self.running = True # clear any running music #self.stop_music() self.lamp_update() # 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 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("Operational", delay=myWait, handler=self.start_river_chase, param=2) if step == 2: # set up the title card titleCard = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_rotrTitle.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) self.delay("Operational", delay=2, handler=lambda: self.play_ordered_quote( self.game.assets.quote_rotrIntro, 'start'))
def show_award_text(self,blink=None): # create the two text lines awardTextTop = ep.EP_TextLayer(128/2,3,self.game.assets.font_5px_bold_AZ,justify="center",opaque=False) awardTextBottom = ep.EP_TextLayer(128/2,11,self.game.assets.font_15px_az,justify="center",opaque=False) # if blink frames we have to set them if blink: awardTextTop.set_text(self.awardString,blink_frames=blink,seconds=1,color=ep.BROWN) awardTextBottom.set_text(self.awardPoints,blink_frames=blink,seconds=1,color=ep.RED) else: awardTextTop.set_text(self.awardString,color=ep.BROWN) awardTextBottom.set_text(self.awardPoints,color=ep.RED) # combine them completeFrame = dmd.GroupedLayer(128, 32, [self.border,awardTextTop,awardTextBottom]) # swap in the new layer currentLayer = self.layer self.transition = ep.EP_Transition(self,currentLayer,completeFrame,self.type) # clear in 2 seconds self.delay(name="Display",delay=2,handler=self.clear_layer)
def show_award_text(self,blink=None): # create the two text lines awardTextTop = ep.EP_TextLayer(128/2,5,self.game.assets.font_5px_bold_AZ,justify="center",opaque=False) awardTextBottom = ep.EP_TextLayer(128/2,11,self.game.assets.font_15px_az,justify="center",opaque=False) # if blink frames we have to set them if blink: awardTextTop.set_text(self.awardString,blink_frames=12,color=ep.DARK_BROWN) awardTextBottom.set_text(self.awardPoints,blink_frames=12,color=ep.BROWN) else: awardTextTop.set_text(self.awardString,color=ep.DARK_BROWN) awardTextBottom.set_text(self.awardPoints,color=ep.BROWN) # combine them completeFrame = dmd.GroupedLayer(128, 32, [self.border,awardTextTop,awardTextBottom]) # play the sound effect self.game.sound.play(self.game.assets.sfx_gunfightFlourish) # same noise from gunfight # swap in the new layer transition = ep.EP_Transition(self,self.layer,completeFrame,ep.EP_Transition.TYPE_PUSH,ep.EP_Transition.PARAM_NORTH) # clear in 3 seconds self.delay("Display",delay=2,handler=self.clear_layer) # show combo display if the chain is high enough if self.game.combos.chain > 2: self.delay("Display",delay=2,handler=self.game.combos.display)
def intro(self,step=1): if step == 1: self.stop_music() # intro riff duration = self.game.sound.play(self.game.assets.sfx_ssHeavyRiff) # set up the 2 frames for the transition logo = dmd.FrameLayer(opaque=True,frame=self.game.assets.dmd_ssLogo.frames[0]) frog = dmd.FrameLayer(opaque=True,frame=self.game.assets.dmd_ssLeaperWipe.frames[0]) # crossfade transition to the frog sitting self.transition = ep.EP_Transition(self,logo,frog,ep.EP_Transition.TYPE_CROSSFADE) # go to step 2 after duration expires self.delay(delay=duration - 0.8,handler=self.intro,param=2) if step == 2: anim = self.game.assets.dmd_ssLeaperWipe 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" # sounds ? animLayer.add_frame_listener(5,self.game.sound.play,param=self.game.assets.sfx_ssScream) # layers behind the wipe textLine1 = ep.EP_TextLayer(64,11,self.game.assets.font_7px_bold_az, "center", opaque=False).set_text("HIT BEER MUG TO",color=ep.YELLOW) textLine2 = ep.EP_TextLayer(64,22,self.game.assets.font_7px_bold_az, "center", opaque=False).set_text("SQUASH LEAPERS",color=ep.BROWN) combined = dmd.GroupedLayer(128,32,[self.titleLine,textLine2,textLine1,animLayer]) self.layer = combined self.delay(delay = myWait,handler=self.intro,param=3) if step == 3: textLine1 = ep.EP_TextLayer(64,11,self.game.assets.font_7px_bold_az, "center", opaque=False).set_text("HIT BEER MUG TO",blink_frames=8,color=ep.YELLOW) textLine2 = ep.EP_TextLayer(64,22,self.game.assets.font_7px_bold_az, "center", opaque=False).set_text("SQUASH LEAPERS",color=ep.BROWN) combined = dmd.GroupedLayer(128,32,[self.titleLine,textLine2,textLine1]) self.layer = combined self.game.sound.play(self.game.assets.quote_ssStart) self.delay(delay = 1.5,handler=self.get_going)
def jackpot_hit(self,step=1): if step == 1: # log the hit in audits self.game.game_data['Feature']['Stampede Jackpots'] += 1 # play an animation anim = self.game.assets.dmd_stampedeJackpot myWait = len(anim.frames) / 15.0 animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=True,repeat=False,frame_time=4) self.layer = animLayer self.game.base.play_quote(self.game.assets.quote_jackpot) # and some sounds self.game.sound.play(self.game.assets.sfx_revRicochet) # loop back to do the next part self.delay(name="Display",delay=myWait+0.5,handler=self.jackpot_hit,param=2) # second pass layers the score over the text if step == 2: self.backdrop = dmd.FrameLayer(opaque=True, frame=self.game.assets.dmd_stampedeJackpot.frames[42]) self.scoreLine = ep.EP_TextLayer(64, 8, self.game.assets.font_17px_score, "center", opaque=True).set_text(str(ep.format_score(self.scored)),color=ep.YELLOW) # self.scoreLine.composite_op = "blacksrc" # self.layer = dmd.GroupedLayer(128,32,[self.backdrop,self.scoreLine]) # loop back to cleear # transition to the score transition = ep.EP_Transition(self,self.backdrop,self.scoreLine,ep.EP_Transition.TYPE_CROSSFADE) self.delay(name="Display",delay=2,handler=self.jackpot_hit,param=3) # third pass plays the wipe if step == 3: anim = self.game.assets.dmd_burstWipe myWait = len(anim.frames) / 15.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 4 animLayer.composite_op = "blacksrc" self.layer = dmd.GroupedLayer(128,32,[self.backdrop,self.scoreLine,animLayer]) # play a sound on delay self.delay(name="Display",delay=myWait,handler=self.game.sound.play,param=self.game.assets.sfx_explosion1) # then do the main display self.delay(name="Display",delay=myWait,handler=self.main_display)
def show_award_text(self, blink=None): # create the two text lines awardTextTop = ep.EP_TextLayer(128 / 2, 5, self.game.assets.font_5px_bold_AZ, justify="center", opaque=False) awardTextBottom = ep.EP_TextLayer(128 / 2, 11, self.game.assets.font_15px_az, justify="center", opaque=False) # if blink frames we have to set them if blink: awardTextTop.set_text(self.awardString, blink_frames=12, color=ep.BLUE) awardTextBottom.set_text(self.awardPoints, blink_frames=12, color=ep.CYAN) else: awardTextTop.set_text(self.awardString, color=ep.BLUE) awardTextBottom.set_text(self.awardPoints, color=ep.CYAN) # combine them completeFrame = dmd.GroupedLayer( 128, 32, [self.border, awardTextTop, awardTextBottom]) # swap in the new layer #self.layer = completeFrame transition = ep.EP_Transition(self, self.layer, completeFrame, ep.EP_Transition.TYPE_PUSH, ep.EP_Transition.PARAM_WEST) # clear in 2 seconds self.delay(name="Display", delay=2, handler=self.clear_layer) # show combo display if the chain is high enough if self.game.combos.chain > 1: self.delay(name="Display", delay=2, handler=self.game.combos.display)
def clear_ship(self): shipLayer = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_cvaLargeShip.frames[0]) self.transition = ep.EP_Transition(self,self.staticShip,shipLayer,ep.EP_Transition.TYPE_WIPE,ep.EP_Transition.PARAM_WEST,callback=self.one_beat)
def hit(self, step=1): print "Hitting bionic bart" if step == 1: # audit self.game.game_data['Feature']['Bionic Bart Hits'] += 1 # turn off loaded and the lights self.loaded = False self.lamp_update() anim = self.game.assets.dmd_burstWipe myWait = len(anim.frames) / 14.0 # set the animation animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 4 # hit the knocker self.game.interrupter.knock(1, realOnly=True) self.game.sound.play(self.game.assets.sfx_explosion11) self.layer = animLayer # move the hat and bart self.game.bart.animate(3) # tick up the hits self.hits += 1 if self.hits >= self.hitsToDefeat: self.bionic_defeated() else: # a flourish lampshow self.game.lampctrl.play_show(self.game.assets.lamp_sparkle, repeat=False, callback=self.lamp_update) self.delay(delay=myWait, handler=self.hit, param=2) if step == 2: # pick a random banner to use banner = random.choice(self.banners) # set up the banner layer bannerLayer = dmd.FrameLayer(opaque=False, frame=banner.frames[0]) bannerLayer.composite_op = "blacksrc" fadeTo = dmd.GroupedLayer(128, 32, [self.stunnedLayer, bannerLayer]) self.game.sound.play(self.game.assets.sfx_hitBionicBart) transition = ep.EP_Transition(self, self.layer, fadeTo, ep.EP_Transition.TYPE_CROSSFADE) self.delay(delay=0.8, handler=self.hit, param=3) if step == 3: self.set_bart_layer(self.stunnedLayer) self.game.score(self.hitValue, bonus=True) self.set_action_line(str(ep.format_score(self.hitValue))) self.set_status_line(style="HIT") # increase the hit value for next time self.hitValue += 250000 self.update_display() self.delay(delay=0.8, handler=self.hit, param=4) if step == 4: self.game.squelch_music() self.set_bart_layer(self.whineLayer) self.flash() self.update_display() duration = self.game.base.play_quote( self.game.assets.quote_hitBionicBart) self.delay(delay=duration, handler=self.hit, param=5) if step == 5: self.cancel_delayed("Flashing") self.game.restore_music() self.set_bart_layer(self.idleLayer) self.shots = 0 self.set_action_line() self.set_status_line(self.shotsToLoad) self.update_display() # activate the current shots self.activate_shots(self.shotsToLoad - self.shots) # kick the ball print "Bionic Hit Saloon Kick" self.game.saloon.kick() # start a ball save if configured if self.ballSave: self.game.trough.start_ball_save(num_balls_to_save=1, time=self.saveDuration, now=True, allow_multiple_saves=False)
def advance_save_polly(self): self.game.train.stop() # add the sucessful shot self.shotsSoFar += 1 textString2 = str((self.shotsToWin - self.shotsSoFar)) + " SHOTS FOR" self.prog_awardLine1.set_text(textString2) if self.shotsSoFar >= self.shotsToWin: # score points for last shot # figure in the multiplier points = self.shotValue * self.valueMultiplier self.game.score(points) # add to total self.totalPoints += points self.lastPoints = points self.polly_saved() else: # score points # figure in the multiplier points = self.shotValue * self.valueMultiplier self.game.score(points) # add to total self.totalPoints += points self.lastPoints = points # increase the multiplier self.raise_multiplier() # setup the display border = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_tracksBorder.frames[0]) pollyTitle = ep.EP_TextLayer(64, 0, self.game.assets.font_5px_bold_AZ, "center", opaque=False).set_text( "POLLY PERIL", color=ep.MAGENTA) scoreLine = dmd.TextLayer( 64, 6, self.game.assets.font_7px_bold_az, "center", opaque=False).set_text(str(ep.format_score(self.lastPoints))) textString2 = str( (self.shotsToWin - self.shotsSoFar)) + " SHOTS FOR" awardLine1 = ep.EP_TextLayer(64, 15, self.game.assets.font_6px_az, "center", opaque=False).set_text( textString2, color=ep.MAGENTA) completeFrame = dmd.GroupedLayer( 128, 32, [border, pollyTitle, scoreLine, awardLine1, self.awardLine2b]) transition = ep.EP_Transition(self, self.layer, completeFrame, ep.EP_Transition.TYPE_PUSH, ep.EP_Transition.PARAM_NORTH) # pause the train briefly self.delay(name="Pause Timer", delay=1.5, handler=self.pause_timer, param=4)
def static_to_score(self): self.transition = ep.EP_Transition(self,self.staticLayer,self.blankLayer,ep.EP_Transition.TYPE_CROSSFADE,callback=self.one_beat)
def start_save_polly(self, step=1): if step == 1: # audit self.game.game_data['Feature']['Center Polly Started'] += 1 # set the level 1 stack flag self.game.stack_level(2, True) # set the running flag self.running = True # clear any running music #self.stop_music() # set the center to crazy stage self.game.set_tracking('centerRampStage', 99) self.lamp_update() ## TEMP PLAY INTRO duration = self.game.base.priority_quote( self.game.assets.quote_ttttDox) # Secondary intro quote self.delay("Operational", delay=duration + 0.1, handler=self.secondary_intro_quote) # start the music self.music_on(self.game.assets.music_pollyPeril) # reset the train self.game.train.reset_toy(step=2) # 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 # set the timer for the mode self.modeTimer = 30 # setup some layers # alternate lines for the bottom script = [] shotsLine1 = dmd.TextLayer(34, 11, self.game.assets.font_5px_AZ, "center", opaque=False).set_text("SHOTS WORTH:") shotsLine2 = ep.EP_TextLayer( 34, 17, self.game.assets.font_7px_az, "center", opaque=False).set_text(str(ep.format_score(self.shotValue)), color=ep.MAGENTA) # group layer of the award lines textString2 = str( (self.shotsToWin - self.shotsSoFar)) + " SHOTS FOR" self.prog_awardLine1 = dmd.TextLayer( 34, 11, self.game.assets.font_7px_az, "center", opaque=False).set_text(textString2) page1 = dmd.GroupedLayer(128, 32, [self.prog_awardLine1, self.awardLine2]) page1.composite_op = "blacksrc" script.append({"seconds": 2, "layer": page1}) # group layer of the shot value info lines page2 = dmd.GroupedLayer(128, 32, [shotsLine1, shotsLine2]) page2.composite_op = "blacksrc" script.append({"seconds": 2, "layer": page2}) # scripted layer alternating between the info and award lines self.infoLayer = dmd.ScriptedLayer(128, 32, script) self.infoLayer.composite_op = "blacksrc" # loop back for the title card self.delay("Operational", delay=myWait, handler=self.start_save_polly, param=2) if step == 2: # set up the title card titleCard = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_ttttBanner.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 bionic_defeated(self, step=1): # VICTOLY! if step == 1: # audit self.game.game_data['Feature']['Bionic Bart Kills'] += 1 self.won = True # stop the music self.stop_music() # load up the defeated animation anim = self.game.assets.dmd_bionicDeath # set the animation animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = False animLayer.repeat = True animLayer.frame_time = 6 fadeTo = animLayer transition = ep.EP_Transition(self, self.layer, fadeTo, ep.EP_Transition.TYPE_CROSSFADE) # run a lamp set self.defeat_lamps() duration = self.game.sound.play(self.game.assets.sfx_hitBionicBart) self.delay(delay=duration, handler=self.bionic_defeated, param=2) if step == 2: # play the beeping noise duration = self.game.sound.play(self.game.assets.sfx_dieBionicBart) self.delay(delay=duration, handler=self.bionic_defeated, param=3) if step == 3: # load a black layer to cover the score # blank = dmd.FrameLayer(opaque=True, frame=dmd.Animation().load(ep.DMD_PATH+'blank.dmd').frames[0]) # # play the death quote over the whine bot # self.whineLayer.set_target_position(-43,0) self.flash() # combined = dmd.GroupedLayer(128,32,[blank,self.whineLayer]) # load up the defeated animation anim = self.game.assets.dmd_bionicDeathTalking # set the animation animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = False animLayer.repeat = True animLayer.frame_time = 6 self.layer = animLayer # play the quote duration = self.game.base.play_quote( self.game.assets.quote_defeatBionicBart) self.delay(delay=duration, handler=self.bionic_defeated, param=4) if step == 4: self.cancel_delayed("Flashing") # this is the part where we blow up anim = self.game.assets.dmd_bionicExplode # set the animation animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 6 myWait = len(anim.frames) / 10.0 self.layer = animLayer # play the explosion self.game.sound.play(self.game.assets.sfx_heavyExplosion) self.delay(delay=myWait, handler=self.bionic_defeated, param=5) if step == 5: # reset the whine layer target in case it comes back up in this game self.whineLayer.set_target_position(0, 0) # then do the text display line1 = dmd.TextLayer(64, 3, self.game.assets.font_15px_bionic, "center", opaque=True).set_text("DEFEATED!") scoreString = str(ep.format_score(5000000)) + " POINTS" line2 = ep.EP_TextLayer(64, 22, self.game.assets.font_5px_AZ, "center", opaque=False).set_text(scoreString, blink_frames=8, color=ep.ORANGE) combined = dmd.GroupedLayer(128, 32, [line1, line2]) self.layer = combined # score points self.game.score(5000000) # light high noon self.game.badge.light_high_noon() self.leader_final_quote("win")
def defeat(self): print "DEFEATING BART" # log the hit in audits self.game.game_data['Feature']['Barts Defeated'] += 1 # count barts to the reset total = self.game.increase_tracking('bartsDefeated') # tick up the global count as well globalTotal = self.game.increase_tracking('bartsDefeatedTotal') # this bart total counts just regualr barts if self.brother != "BOSS": self.game.increase_tracking('regularBartsDefeated') # move bart self.animate(1) # play a defeated quote myWait = self.game.base.play_quote(self.defeatQuote, squelch=True) # set the end number for cyling back around - new due to guests if self.guests: endnumber = 5 else: endnumber = 4 bossPosition = 6 # set the status to dead - gunfight has to set it back to open self.game.set_tracking('bartStatus', "DEAD") # if we're one away from the badge, switch to boss if self.bartsForStar - total == 1: # by jumping ahead to the 5th spot self.game.set_tracking('currentBart', bossPosition) # if we just did boss bart, figure out where we were in the rotation elif self.game.show_tracking('currentBart') == bossPosition: nextBart = (self.game.show_tracking('regularBartsDefeated') % (endnumber + 1)) - 1 self.game.set_tracking('currentBart', nextBart) # if we're at the end of the line, reset to 0 elif self.game.show_tracking('currentBart') == endnumber: self.game.set_tracking('currentBart', 0) # if not tick up the current bart for next time else: self.game.increase_tracking('currentBart') # score some points # if alternate boss version - multiply points by bad guys and update the string if self.boss_alternate: points = self.defeatValue * self.game.bad_guys.count_active() self.game.score(points) self.defeatString = locale.format("%d", self.defeatValue, True) # Add commas else: self.game.score(self.defeatValue) # add some bonus self.game.add_bonus(150000) # reset the hits on bart self.game.set_tracking('bartHits', 0) # play a fancy lampshow self.game.lampctrl.play_show(self.game.assets.lamp_sparkle, False, self.lamp_update) # kill the bossfight flag just to cover if it's on if self.bossFight == True: self.bossFight = False # drop all the targets that are still up self.drop_posse() # setup the display #backdrop = dmd.FrameLayer(opaque=False, frame=self.wantedFrameB) textLayer1 = ep.EP_TextLayer(40, 1, self.game.assets.font_7px_az, justify="center", opaque=False).set_text("BART DEFEATED", color=ep.BROWN) textLayer2 = ep.EP_TextLayer(40, 9, self.game.assets.font_9px_az, justify="center", opaque=False).set_text(str( self.defeatString), color=ep.GREEN) textLayer2.composite_op = "blacksrc" if total < self.bartsForStar: theText = str(self.bartsForStar - total) + " MORE" theText2 = str("FOR BADGE") elif total == self.bartsForStar: theText = "BADGE" theText2 = "COLLECTED!" # actually collect the badge - barts defeated is 2 self.game.badge.update(2) else: theText = str(globalTotal) + " BARTS" theText2 = "DEFEATED!" textLayer3 = ep.EP_TextLayer(40, 20, self.game.assets.font_5px_AZ, justify="center", opaque=False).set_text(theText, color=ep.DARK_RED) textLayer3.composite_op = "blacksrc" textLayer4 = ep.EP_TextLayer(40, 26, self.game.assets.font_5px_AZ, justify="center", opaque=False).set_text(theText2, color=ep.DARK_RED) textLayer4.composite_op = "blacksrc" # banner top layer primaryLayer = dmd.GroupedLayer(128, 32, [self.bannerLayer, self.wantedFrameA]) self.layer = primaryLayer secondaryLayer = dmd.GroupedLayer(128, 32, [ self.wantedFrameB, textLayer1, textLayer2, textLayer3, textLayer4 ]) transition = ep.EP_Transition(self, primaryLayer, secondaryLayer, ep.EP_Transition.TYPE_PUSH, ep.EP_Transition.PARAM_NORTH) # light gunfight? self.delay(delay=myWait, handler=self.game.saloon.light_gunfight) # clear the layer self.delay("Display", delay=myWait, handler=self.clear_layer)
def jackpot_hit(self, step=1): if step == 1: # audit self.game.game_data['Feature']['Gold Mine Jackpots'] += 1 # clear the display self.abort_display() # award the points points = 500000 if self.game.drunk_multiball.running: points += 500000 self.game.score(points) # count the jackpot self.jackpots += 1 # increase the motherlode value self.motherlodeValue += 250000 if self.game.drunk_multiball.running: self.motherlodeValue += 250000 # see if the multiplier goes up self.multiplier = self.check_multiplier() # play the animation anim = self.game.assets.dmd_mineCarCrash # 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 self.layer = animLayer # play a quote self.game.sound.play(self.game.assets.sfx_revRicochet) # loop back to step 2 self.delay(name="Display", delay=myWait, handler=self.jackpot_hit, param=2) if step == 2: # grab the last frame of the minecart crash backdrop = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_mineCarCrash.frames[9]) # and setup the text layer to say jackpot jackpotLine = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_goldmineJackpot.frames[0]) # then do the transition transition = ep.EP_Transition(self, backdrop, jackpotLine, ep.EP_Transition.TYPE_CROSSFADE) # play a quote self.play_ordered_quote(self.game.assets.quote_jackpot, 'jackpot', priority=True) # and loop back for step 3 self.delay(name="Display", delay=.8, handler=self.jackpot_hit, param=3) if step == 3: # then show 'multiball jackpot' with points awardTextTop = ep.EP_TextLayer(128 / 2, 5, self.game.assets.font_5px_bold_AZ, justify="center", opaque=True) awardTextBottom = ep.EP_TextLayer(128 / 2, 11, self.game.assets.font_15px_az, justify="center", opaque=False) awardTextTop.set_text("MULTIBALL JACKPOT", color=ep.ORANGE) bottomString = str(ep.format_score(500000)) if self.game.drunk_multiball.running: bottomString = str(ep.format_score(1000000)) awardTextBottom.set_text(bottomString, blink_frames=4, color=ep.YELLOW) combined = dmd.GroupedLayer(128, 32, [awardTextTop, awardTextBottom]) self.layer = combined # turn on the motherlode if needed self.check_motherlode() # if multipier went up, we go there, not, it's back to main if self.multiplier: handler = self.display_multiplier # and reset the jackpots for i in range(0, 5, 1): self.game.set_tracking('jackpotStatus', True, i) # and refresh all the lamps self.lamp_update() else: handler = self.main_display # go back to the main display self.delay(name="Display", delay=1.5, handler=handler)
def push_out(self): # crap I had this then it stopped working print "TRANSITIONING WTF" self.transition = ep.EP_Transition(self,self.layer,self.game.score_display.layer,ep.EP_Transition.TYPE_PUSH,ep.EP_Transition.PARAM_SOUTH) self.transition.callback = self.clear_layer()
def push_out(self): self.transition = ep.EP_Transition(self, self.layer, self.game.score_display.layer, ep.EP_Transition.TYPE_PUSH, self.anims[1]['direction']) self.transition.callback = self.clear_layer
def intro(self, step=1): if step == 1: self.stop_music() self.delay(delay=0.5, handler=self.game.base.play_quote, param=self.game.assets.quote_mmTrolls) introWait = self.game.sound.play(self.game.assets.sfx_mmIntro) self.delay(delay=introWait, handler=self.game.music_on, param=self.game.assets.music_trolls) border = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_singlePixelBorder.frames[0]) titleLine = ep.EP_TextLayer(64, 2, self.game.assets.font_9px_az, "center", False).set_text("TROLLS!", color=ep.GREEN) infoLine1 = ep.EP_TextLayer( 64, 14, self.game.assets.font_5px_AZ, "center", False).set_text("SHOOT EACH TROLL " + str(self.hitsToWin) + " TIMES") infoLine2 = ep.EP_TextLayer(64, 20, self.game.assets.font_5px_AZ, "center", False).set_text("TO FINISH") combined = dmd.GroupedLayer( 128, 32, [border, titleLine, infoLine1, infoLine2]) self.layer = combined self.delay(delay=2, handler=self.intro, param=2) if step == 2: startFrame = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_mmTrollsIntro.frames[0]) transition = ep.EP_Transition(self, self.layer, startFrame, ep.EP_Transition.TYPE_PUSH, ep.EP_Transition.PARAM_NORTH) self.delay(delay=1.5, handler=self.intro, param=3) if step == 3: anim = self.game.assets.dmd_mmTrollsIntro myWait = len(anim.frames) / 10.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 6 animLayer.repeat = False animLayer.opaque = True # sounds ? animLayer.add_frame_listener(1, self.game.sound.play, param=self.game.assets.sfx_lightning1) animLayer.add_frame_listener(13, self.game.sound.play, param=self.game.assets.sfx_lightning1) # trolls raising animLayer.add_frame_listener(10, self.game.bad_guys.target_up, param=1) animLayer.add_frame_listener(21, self.game.bad_guys.target_up, param=2) # first taunt animLayer.add_frame_listener(25, self.taunt) self.layer = animLayer self.delay(delay=myWait, handler=self.get_going)