def restart_option(self): # this loops while we wait for a restart, if there is one self.restartTimer -= 1 if self.restartTimer <= 0: self.restartFlag = False self.end_multiball() else: if self.restartTimer == 2: self.game.sound.play_music(self.game.assets.music_tensePiano2, loops=-1) print "RESTART DISPLAY" backdrop = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_mineEntranceBorder.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_5px_AZ, justify="center", opaque=False) timeText = ep.EP_TextLayer(64, 17, self.game.assets.font_9px_az, justify="center", opaque=False) timeText.composite_op = "blacksrc" awardTextTop.set_text("SHOOT THE MINE", color=ep.GREEN) awardTextBottom.set_text("TO RESTART MULTIBALL", color=ep.YELLOW) if self.restartTimer == 1: textLine = "1 SECOND" else: textLine = str(self.restartTimer) + " SECONDS" timeText.set_text(textLine, blink_frames=4, color=ep.RED) combined = dmd.GroupedLayer( 128, 32, [backdrop, awardTextTop, awardTextBottom, timeText]) self.layer = combined self.delay(name="Restart Timer", delay=1.0, handler=self.restart_option)
def dude_escaped(self, amount): backdrop = dmd.FrameLayer(opaque=True, frame=self.game.assets.dmd_escaped.frames[0]) backdrop.composite_op = "blacksrc" if amount <= 0: textString = "THEY GOT AWAY - YOU LOSE" else: textString = str(amount) + " MORE AND YOU LOSE" textLine2 = dmd.TextLayer(128 / 2, 18, self.game.assets.font_5px_AZ, "center", opaque=False).set_text(textString, blink_frames=8) textLine2.composite_op = "blacksrc" combined = dmd.GroupedLayer(128, 32, [backdrop, textLine2]) combined.composite_op = "blacksrc" self.layer = combined self.delay(name="Display", delay=1, handler=self.clear_layer)
def __init__(self, game, priority): super(Quickdraw, self).__init__(game, priority) self.myID = "QuickDraw" # default self.side = 0 self.target = 0 # build the pause view script = [] # set up the text layer textString = "< QUICKDRAW PAUSED >" textLayer = ep.EP_TextLayer(128 / 2, 24, self.game.assets.font_6px_az_inverse, "center", opaque=False).set_text(textString, color=ep.YELLOW) script.append({'seconds': 0.3, 'layer': textLayer}) # set up the alternating blank layer blank = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_blank.frames[0]) blank.composite_op = "blacksrc" script.append({'seconds': 0.3, 'layer': blank}) # make a script layer with the two self.pauseView = dmd.ScriptedLayer(128, 32, script) self.pauseView.composite_op = "blacksrc" self.eb_wins = self.game.user_settings['Gameplay (Feature)'][ 'Quickdraw Wins for EB'] self.taunting = False self.keys_index = { 'taunt': list( range( len(self.game.sound.sounds[ self.game.assets.quote_quickdrawTaunt]))), 'hit': list( range( len(self.game.sound.sounds[ self.game.assets.quote_quickdrawWin]))) } self.counts_index = {'taunt': 0, 'hit': 0} random.shuffle(self.keys_index['hit']) random.shuffle(self.keys_index['taunt'])
def mode_started(self): duration = self.game.sound.play(self.game.assets.sfx_dinnerBell) self.delay("Music", delay=duration, handler=self.music_on, param=self.game.assets.music_beans) self.game.modes.add(self.game.franks_switches) self.game.set_tracking('farted', True) self.running = True self.time = self.game.user_settings['Gameplay (Feature)'][ 'Franks N Beans Time'] + 1 # build the display background = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_franksBackdrop.frames[0]) self.scoreLine = ep.EP_TextLayer(48, 1, self.game.assets.font_7px_az, "center", opaque=False) titleLine = ep.EP_TextLayer(48, 12, self.game.assets.font_9px_az, "center", opaque=False).set_text("FRANKS N BEANS", color=ep.ORANGE) infoLine = ep.EP_TextLayer(48, 24, self.game.assets.font_5px_AZ, "center", opaque=False).set_text( "SWITCHES + " + ep.format_score(20000), color=ep.RED) self.timeLine = ep.EP_TextLayer(126, 1, self.game.assets.font_5px_AZ, "right", opaque=False) self.timer_loop() self.update_display() combined = dmd.GroupedLayer( 128, 32, [background, titleLine, infoLine, self.scoreLine, self.timeLine]) self.layer = combined
def drunk_bonus(self): print "DMB Disabled, Drunk bonus" # grab the point values points = self.game.show_tracking('drunkBonusValue') # show a screen mug = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_beerMug1.frames[0]) mug.composite_op = "blacksrc" words = ep.EP_TextLayer(51, 3, self.game.assets.font_9px_az, "center", opaque=False).set_text("DRUNK BONUS", color=ep.YELLOW) score = ep.EP_TextLayer(51, 15, self.game.assets.font_9px_az, "center", opaque=False).set_text(ep.format_score(points), blink_frames=8, color=ep.GREEN) combined = dmd.GroupedLayer(128, 32, [words, score, mug]) self.layer = combined self.game.sound.play(self.game.assets.sfx_pour) # unload after 2 seconds self.delay("Operational", delay=2, handler=self.unload) # score some points self.game.score(points) # increase the text award self.game.set_tracking('drunkBonusValue', (points + 100000)) # reset the mug hits for next time self.game.set_tracking('beerMugHits', 0) # tick up the shots needed for next time self.game.increase_tracking( 'mug_shots', self.game.user_settings['Gameplay (Feature)'] ['Beer Mug Hits Boost']) # Eject the ball self.game.saloon.kick() # reset the DMB status self.game.set_tracking('drunkMultiballStatus', "OPEN")
def __init__(self, game, priority): super(BankRobbery, self).__init__(game, priority) self.myID = "Bank Robbery" self.position = [-49, -4, 43] self.y_pos = 7 self.isActive = [True, True, True] self.shots = [ self.game.left_ramp, self.game.center_ramp, self.game.right_ramp ] self.won = False self.flashers = [ self.game.coils.backLeftFlasher, self.game.coils.backRightFlasher, self.game.coils.middleRightFlasher ] script = [] # set up the text layer textString = "< SAVE POLLY PAUSED >" textLayer = ep.EP_TextLayer(128 / 2, 24, self.game.assets.font_6px_az_inverse, "center", opaque=False).set_text(textString, color=ep.GREEN) script.append({'seconds': 0.3, 'layer': textLayer}) # set up the alternating blank layer blank = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_blank.frames[0]) blank.composite_op = "blacksrc" script.append({'seconds': 0.3, 'layer': blank}) # make a script layer with the two self.pauseView = dmd.ScriptedLayer(128, 32, script) self.pauseView.composite_op = "blacksrc" self.keys_index = { 'start': list( range( len(self.game.sound.sounds[ self.game.assets.quote_hatbIntro]))) } self.counts_index = {'start': 0} random.shuffle(self.keys_index['start'])
def tumbleweed_display(self,value,combo): banner = dmd.FrameLayer(opaque=True, frame=self.game.assets.dmd_tumbleweedBanner.frames[0]) scoreLayer = dmd.TextLayer(64,22,self.game.assets.font_9px_az,justify="center",opaque=False).set_text(str(ep.format_score(value)),blink_frames=6) # load up the animation anim = self.game.assets.dmd_tumbleweedLeft # 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 display_frogs(self,mode=None,num=None,fade=False): if not self.won: self.cancel_delayed("Display") # set the frogs for n in self.availFrogs: if n != num: # grab the last frame from the first slot animation self.frogLayers[n] = dmd.FrameLayer(opaque=False,frame=self.liveFrogs[n][4].frames[5]) # set the composite op self.frogLayers[n].composite_op = "blacksrc" # adjust the position self.frogLayers[n].set_target_position(self.offsets[n],0) if mode == "jump": anim = self.liveFrogs[num][0] myWait = len(anim.frames) / 10.0 self.frogLayers[num] = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=False,repeat=False,frame_time=6) self.frogLayers[num].composite_op = "blacksrc" self.frogLayers[num].set_target_position(self.offsets[num],0) # reverse the order of that frog for next jump self.liveFrogs[num].reverse() else: # if we didn't get a cue to change cousin it, we don't mess with him pass # build the layer layers = [] layers.append(self.titleLine) layers.append(self.leftTimerLine) layers.append(self.rightTimerLine) layers.append(self.scoreLine) for layer in self.frogLayers: layers.append(layer) combined = dmd.GroupedLayer(128,32,layers) # turn on the layer - crossfade at startup self.layer = combined # set the delay for fixing it after a hit or a miss if mode == "jump" and len(self.availFrogs) > 0: choices = [0.65,0.8,1.0,1.2,1.4] self.game.sound.play(self.game.assets.sfx_ssRibbit) self.delay("Display",delay=random.choice(choices),handler=lambda: self.display_frogs(mode="jump",num=random.choice(self.availFrogs)))
def polly_died(self): self.game.peril = False self.running = False self.wipe_delays() backdrop = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_poutySheriff.frames[0]) textLine1 = ep.EP_TextLayer(25, 8, self.game.assets.font_12px_az, justify="center", opaque=False).set_text("TOO", color=ep.RED) textLine2 = ep.EP_TextLayer(98, 8, self.game.assets.font_12px_az, justify="center", opaque=False).set_text("LATE!", color=ep.RED) combined = dmd.GroupedLayer(128, 32, [backdrop, textLine1, textLine2]) self.layer = combined self.game.sound.play(self.game.assets.sfx_glumRiff) self.delay("Operational", delay=1.5, handler=self.end_river_chase)
def polly_died(self, drain=False): self.game.peril = False self.cancel_delayed("Mode Timer") backdrop = dmd.FrameLayer(opaque=True, frame=self.game.assets.dmd_poutySheriff.frames[0]) textLine1 = ep.EP_TextLayer(25, 8, self.game.assets.font_12px_az, justify="center", opaque=False) if drain: string = "OH" else: string = "TOO" textLine1.set_text(string, color=ep.RED) textLine2 = ep.EP_TextLayer(98, 8, self.game.assets.font_12px_az, justify="center", opaque=False) if drain: string = "NO!" else: string = "LATE!" textLine2.set_text(string, color=ep.RED) combined = dmd.GroupedLayer(128, 32, [backdrop, textLine1, textLine2]) self.layer = combined self.game.sound.play(self.game.assets.sfx_glumRiff) self.delay("Operational", delay=1.5, handler=self.end_bank_robbery)
def gunfight_release(self): # play the draw quote self.game.base.play_quote(self.game.assets.quote_gunfightDraw) text = ep.EP_TextLayer(28,8,self.game.assets.font_12px_az,"center",opaque=False).set_text("DRAW!",blink_frames=2,color=ep.RED) backdrop = dmd.FrameLayer(opaque=True, frame=self.game.assets.dmd_gunfightBoots.frames[8]) self.layer = dmd.GroupedLayer(128,32,[backdrop,text]) # turn the GI back on self.game.set_tracking('lampStatus', "ON") self.game.gi_control("ON") self.lamp_update() # kill the starting flag self.starting = False print "DROP THE POST" self.posts[self.activeSide].disable() # if there was ball save time left, put that back if self.save_timer > 0: self.game.trough.start_ball_save(self.save_timer,1) # set the shooting flag self.shooting = True # set a named timer for gunfight lost self.delay("Gunfight Lost",delay=4,handler=self.lost)
def jackpot_score(self, points=0): if self.showDub: double = True self.showDub = False else: double = False self.game.sound.play(self.game.assets.sfx_orchestraSpike) scoreString = str(ep.format_score(points)) print "Score string: " + scoreString backdrop = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_dmbJackpot.frames[17]) if double: scoreLine1 = ep.EP_TextLayer(64, 2, self.game.assets.font_12px_az_outline, "center", opaque=False) scoreLine1.composite_op = "blacksrc" scoreLine1.set_text("DOUBLE", color=ep.GREEN) scoreLine2 = ep.EP_TextLayer(64, 15, self.game.assets.font_12px_az_outline, "center", opaque=False) scoreLine2.composite_op = "blacksrc" scoreLine2.set_text(scoreString, color=ep.GREEN) combined = dmd.GroupedLayer(128, 32, [backdrop, scoreLine1, scoreLine2]) else: scoreLine = ep.EP_TextLayer(64, 8, self.game.assets.font_15px_az_outline, "center", opaque=False) scoreLine.composite_op = "blacksrc" scoreLine.set_text(scoreString, color=ep.GREEN) combined = dmd.GroupedLayer(128, 32, [backdrop, scoreLine]) self.layer = combined self.delay(name="Display", delay=1, handler=self.main_display)
def finish_trolls(self): # kill the delays self.wipe_delays() # drop the targets self.game.bad_guys.drop_targets() border = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_mmTrollFinalFrame.frames[0]) textLayer1 = ep.EP_TextLayer(64, 8, self.game.assets.font_5px_AZ, "center", opaque=False) if self.won: textLayer1.set_text("TROLLS DESTROYED", color=ep.DARK_GREEN) # add some extra points if won - to make it a cool 1.5 million self.game.score(450000) self.totalPoints += 450000 else: textLayer1.set_text("TROLLS ESCAPED", color=ep.DARK_GREEN) textLayer2 = ep.EP_TextLayer(64, 14, self.game.assets.font_9px_az, "center", opaque=False).set_text(str( ep.format_score(self.totalPoints)), color=ep.GREEN) combined = dmd.GroupedLayer(128, 32, [border, textLayer1, textLayer2]) self.layer = combined # play a final quote ? if self.won: self.delay(delay=1, handler=self.game.base.priority_quote, param=self.game.assets.quote_mmFatality) elif self.leftHitsSoFar == 0 and self.rightHitsSoFar == 0: self.game.base.priority_quote(self.game.assets.quote_mmYouSuck) else: self.game.sound.play(self.game.assets.sfx_cheers) myWait = 2 self.delay(delay=myWait, handler=self.done)
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() # 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) self.delay(delay=2, handler=lambda: self.play_ordered_quote( self.game.assets.quote_hatbIntro, 'start'))
def bumpers_increased(self, value): backdrop = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_singleCactusBorder.frames[0]) topLine = dmd.TextLayer(60, 1, self.game.assets.font_5px_AZ, "center", opaque=False).set_text("JET BUMPERS VALUE") increasedLine1 = dmd.TextLayer(60, 8, self.game.assets.font_12px_az, "center", opaque=False).set_text("INCREASED") increasedLine2 = dmd.TextLayer(60, 8, self.game.assets.font_15px_az_outline, "center", opaque=False) increasedLine1.composite_op = "blacksrc" increasedLine2.composite_op = "blacksrc" increasedLine2.set_text("INCREASED") pointsLine = dmd.TextLayer(60, 18, self.game.assets.font_12px_az_outline, "center", opaque=False) pointsLine.composite_op = "blacksrc" pointsLine.set_text(str(ep.format_score(value))) script = [] layer1 = dmd.GroupedLayer( 128, 32, [backdrop, topLine, increasedLine1, pointsLine]) layer2 = dmd.GroupedLayer( 128, 32, [backdrop, topLine, pointsLine, increasedLine2]) script.append({'seconds': 0.3, 'layer': layer1}) script.append({'seconds': 0.3, 'layer': layer2}) self.game.base.play_quote(self.game.assets.quote_yippie) self.layer = dmd.ScriptedLayer(128, 32, script) self.delay("Display", delay=2, handler=self.clear_layer)
def display_multiplier(self): multiplier = self.game.show_tracking('motherlodeMultiplier') # and do a display thing backdrop = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_mineEntranceBorder.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("MOTHERLODE", color=ep.YELLOW) awardTextBottom.set_text(str(multiplier) + "X", color=ep.GREEN) combined = dmd.GroupedLayer(128, 32, [backdrop, awardTextTop, awardTextBottom]) self.layer = combined self.delay(name="Display", delay=1.5, handler=self.main_display)
def __init__(self, game, priority): super(RiverChase, self).__init__(game, priority) self.myID = "River Chase" self.shotsToWin = self.game.user_settings['Gameplay (Feature)'][ 'Save Polly Shots - River'] self.shotsSoFar = 0 self.running = False self.halted = False self.won = False self.distance_value = int(30.0 / self.shotsToWin) self.valueMultiplier = 1 # shot value multiplier script = [] # set up the text layer textString = "< SAVE POLLY PAUSED >" textLayer = ep.EP_TextLayer(128 / 2, 24, self.game.assets.font_6px_az_inverse, "center", opaque=False).set_text(textString, color=ep.BLUE) script.append({'seconds': 0.3, 'layer': textLayer}) # set up the alternating blank layer blank = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_blank.frames[0]) blank.composite_op = "blacksrc" script.append({'seconds': 0.3, 'layer': blank}) # make a script layer with the two self.pauseView = dmd.ScriptedLayer(128, 32, script) self.pauseView.composite_op = "blacksrc" self.keys_index = { 'start': list( range( len(self.game.sound.sounds[ self.game.assets.quote_rotrIntro]))) } self.counts_index = {'start': 0} random.shuffle(self.keys_index['start'])
def end_showdown(self): # drop all teh targets self.game.bad_guys.drop_targets() # turn off the level 1 flag self.game.stack_level(1,False) # kill the music - if nothing else is running # start up the main theme again if a higher level mode isn't running #self.stop_music(slice=2) # tally some score? # award the badge light - showdown/ambush is 3 self.game.badge.update(3) # grab the showdown points before resetting totalPoints = self.game.show_tracking('showdownPoints') self.update_tracking() self.lamp_update() # start up the main theme again if a higher level mode isn't running if self.game.trough.num_balls_in_play > 0: self.music_on(self.game.assets.music_mainTheme,mySlice=2) # setup a display frame backdrop = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_singleCowboySidewaysBorder.frames[0]) textLine1 = ep.EP_TextLayer(74, 1, self.game.assets.font_7px_bold_az, "center", opaque=False) textString = "SHOWDOWN: " + str(self.deathTally) + " KILLS" textLine1.set_text(textString,color=ep.RED) textLine1.composite_op = "blacksrc" textLine2 = ep.EP_TextLayer(74,11, self.game.assets.font_12px_az, "center", opaque=False) textLine2.set_text(ep.format_score(totalPoints),color=ep.GREEN) combined = dmd.GroupedLayer(128,32,[backdrop,textLine1,textLine2]) self.layer = combined # play a quote self.game.base.play_quote(self.game.assets.quote_mobEnd) self.delay("Display",delay=2,handler=self.clear_layer) # see if the death tally beats previous/existing and store in tracking if does - for showdown champ # unset the base busy flag self.game.base.busy = False self.game.base.queued -= 1 # unload the mode self.delay(delay=2.1,handler=self.unload)
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 award_match(self): # check the scores to see if anybody won print "Number of players = " + str(len(self.game.players)) for i in range(0, len(self.game.players), 1): print "Award processing Player " + str((i + 1)) if str(self.playerDigits[i]) == self.selection: # set the text on that layer to blink self.playerLayers[i].set_text(str(self.playerDigits[i]) + "0", blink_frames=8, color=ep.GREEN) # and tick the winner count to true self.winners += 1 # store a list of winning players print("Player " + str(i) + " gets last call") # check to make sure they're not in last call already if i not in self.lastCall: self.lastCall.append(i) # if we had any winners there's stuff to do if self.winners > 0: self.digitLayer.set_text(self.selection, blink_frames=8, color=ep.GREEN) self.zeroLayer.set_text("0", blink_frames=8, color=ep.GREEN) bottlesLayer = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_match.frames[20]) bottlesLayer.composite_op = "blacksrc" combined = dmd.GroupedLayer(128, 32, [ self.digitLayer, self.zeroLayer, self.p1Layer, self.p2Layer, self.p3Layer, self.p4Layer, bottlesLayer ]) self.layer = combined self.game.interrupter.knock(self.winners) self.game.sound.play(self.game.assets.sfx_matchRiff) # Then delay for 2 seconds and shut 'er down self.delay(delay=2, handler=self.finish_up)
def __init__(self,game,priority): super(SS_Tribute, self).__init__(game,priority) self.myID = "SS Tribute" # for timer halting in saloon/jets self.halted = False self.running = False self.hitsToWin = 4 self.hitsSoFar = 0 self.beerHit = False self.won = False script = [] # set up the pause text layer textString = "< LEAPERS PAUSED >" textLayer = ep.EP_TextLayer(128/2, 24, self.game.assets.font_6px_az_inverse, "center", opaque=False).set_text(textString,color=ep.ORANGE) script.append({'seconds':0.3,'layer':textLayer}) # set up the alternating blank layer blank = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_blank.frames[0]) blank.composite_op = "blacksrc" script.append({'seconds':0.3,'layer':blank}) # make a script layer with the two self.pauseView = dmd.ScriptedLayer(128,32,script) self.pauseView.composite_op = "blacksrc" self.titleLine = ep.EP_TextLayer(64,0,self.game.assets.font_7px_bold_az, "center", opaque=True).set_text("LEAPER MANIA",color=ep.GREEN) self.leftTimerLine = ep.EP_TextLayer(0,26,self.game.assets.font_5px_AZ, "left",False) self.rightTimerLine = ep.EP_TextLayer(128,26,self.game.assets.font_5px_AZ,"right",False) self.scoreLine = ep.EP_TextLayer(64,8,self.game.assets.font_9px_az,"center",opaque=False) self.infoLine = ep.EP_TextLayer(0,1,self.game.assets.font_5px_AZ,"center", opaque=False) # offset position for the frog layers based on index position self.offsets = [0,-9,-18,-28] self.keys_index = {'hit':list(range(len(self.game.sound.sounds[self.game.assets.quote_ssHit]))), 'urge':list(range(len(self.game.sound.sounds[self.game.assets.quote_ssUrge])))} self.counts_index = {'hit':0, 'urge':0} random.shuffle(self.keys_index['hit']) random.shuffle(self.keys_index['urge'])
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 hit(self, Saloon=False): # cancel any other displays for mode in self.game.ep_modes: if getattr(mode, "abort_display", None): mode.abort_display() # pick a random banner to use banner = random.choice(self.banners) # set up the banner layer self.bannerLayer = dmd.FrameLayer(opaque=False, frame=banner.frames[0]) # lookup the status status = self.game.show_tracking('bartStatus') print "BART STATUS: " + status print "CURRENT BART: " + str(self.game.show_tracking('currentBart')) # if no bart is currently running, a new challenger appears bionic = self.game.show_tracking('bionicStatus') if bionic == "READY" or bionic == "RUNNING": self.game.saloon.busy = False if status == "OPEN": # if boss is the brother coming up - we don't activate him if other things are running if self.game.show_tracking( 'currentBart') == 3 and True in self.game.show_tracking( 'stackLevel'): self.dead_bart_hit(Saloon) else: self.game.set_tracking('bartStatus', "RUNNING") self.activate() # else, register the hit elif status == "RUNNING": self.damage() # if there is one active and it's the last hit, defeat elif status == "LAST": self.defeat() # not running? do this else: self.dead_bart_hit(Saloon)
def light_lock(self): # set the lock status self.game.set_tracking('mineStatus', "LOCK") # clear the hits to light lock self.game.set_tracking('mineHits', 0) backdrop = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_mineEntranceBorder.frames[0]) textLine = ep.EP_TextLayer(56, 9, self.game.assets.font_12px_az, "center", opaque=False).set_text("LOCK IS LIT", color=ep.GREEN) composite = dmd.GroupedLayer(128, 32, [backdrop, textLine]) self.layer = composite self.delay(name="Display", delay=1.5, handler=self.clear_layer) # play a quote duration = self.game.base.priority_quote( self.game.assets.quote_lockLit) print "LOCK IS LIT ... AND SO AM I" ## then kick the ball self.lamp_update() self.delay(delay=duration + 0.5, handler=self.game.mountain.eject)
def light_gunfight(self, callback=None): print "GUNFIGHT IS LIT" # turn on the lights # show the display backdrop = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_singleCowboyBorder.frames[0]) textString1 = "GUNFIGHT" textLayer1 = ep.pulse_text(self, 77, 2, textString1, size="12px") textString2 = "IS LIT" textLayer2 = ep.pulse_text(self, 77, 15, textString2, size="12px", color=ep.GREEN) self.layer = dmd.GroupedLayer(128, 32, [backdrop, textLayer1, textLayer2]) # play a quote self.game.sound.play(self.game.assets.sfx_flourish6) self.play_ordered_quote(self.game.assets.quote_gunfightLit, 'gunfight', priority=True) # set the tracking self.game.set_tracking('gunfightStatus', "READY") self.lamp_update() self.game.coils.leftGunFlasher.schedule(0x11111111, cycle_seconds=1) self.game.coils.rightGunFlasher.schedule(0x11111111, cycle_seconds=1) if callback != None: print "I GOT A GUNFIGHT CALLBACK" self.delay("Callback", delay=2, handler=callback) self.delay(delay=2, handler=self.clear_layer) if self.busy: print "Light Gunfight - Delay timer for unbusy" self.delay(delay=2, handler=self.unbusy)
def no_layer(self): blank = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_blank.frames[0]) blank.composite_op = "blacksrc" return blank
def __init__(self, game): super(Bogey, self).__init__(game=game, priority=12, mode_type=AdvancedMode.Manual) self.myID = "Bogey" self.running = False self.bogey_lamps = [ self.game.lamps['leftRamp100k'], self.game.lamps['leftRamp200k'], self.game.lamps['leftRamp300k'], self.game.lamps['leftRamp400k'], self.game.lamps['rightRamp100k'], self.game.lamps['rightRamp200k'], self.game.lamps['rightRamp300k'], self.game.lamps['rightRamp400k'], self.game.lamps['leftOrbitArrow'], self.game.lamps['leftRampArrow'], self.game.lamps['rightRampArrow'], self.game.lamps['rightOrbitArrow'] ] self.bogey_clips = [ 'bogey_hit_1', 'bogey_hit_2', 'bogey_hit_3', 'bogey_hit_4', 'bogey_hit_5', 'bogey_hit_6', 'bogey_hit_7', 'bogey_hit_8', 'bogey_hit_9', 'bogey_hit_10', 'bogey_hit_11', 'bogey_hit_12', 'bogey_hit_13', 'bogey_hit_14', 'bogey_hit_15', 'bogey_hit_16', 'bogey_hit_17', 'bogey_hit_18', 'bogey_hit_19', ] back = dmd.FrameLayer( opaque=True, frame=self.game.animations['bogey_backdrop'].frames[0]) top1 = dmd.HDTextLayer(930, 110, self.game.fonts['bebas180'], "center", line_color=[64, 64, 64], line_width=6, interior_color=[192, 192, 192]) top1.set_text("WE'VE") top2 = dmd.HDTextLayer(930, 285, self.game.fonts['bebas180'], "center", line_color=[64, 64, 64], line_width=6, interior_color=[192, 192, 192]) top2.set_text("GOT A") top3 = dmd.HDTextLayer(930, 460, self.game.fonts['bebas180'], "center", line_color=[64, 64, 64], line_width=6, interior_color=[192, 192, 192]) top3.set_text("BOGEY") self.timer_layer = dmd.HDTextLayer(1800, 110, self.game.fonts['bebas500'], "right", line_color=[64, 64, 64], line_width=4, interior_color=[192, 192, 192]) bottom1 = dmd.HDTextLayer(930, 110, self.game.fonts['bebas180'], "center", line_color=[64, 0, 0], line_width=6, interior_color=[192, 0, 0]) bottom1.set_text("SHOOT") bottom2 = dmd.HDTextLayer(930, 285, self.game.fonts['bebas180'], "center", line_color=[64, 0, 0], line_width=6, interior_color=[192, 0, 0]) bottom2.set_text("LIT") bottom3 = dmd.HDTextLayer(930, 460, self.game.fonts['bebas180'], "center", line_color=[64, 0, 0], line_width=6, interior_color=[192, 0, 0]) bottom3.set_text("ARROWS") page1 = dmd.GroupedLayer(1920, 800, [back, top1, top2, top3, self.timer_layer]) page2 = dmd.GroupedLayer(1920, 800, [back, top2, top3, self.timer_layer]) page3 = dmd.GroupedLayer(1920, 800, [back, top3, self.timer_layer]) page4 = dmd.GroupedLayer(1920, 800, [back, self.timer_layer]) page5 = dmd.GroupedLayer(1920, 800, [back, bottom1, self.timer_layer]) page6 = dmd.GroupedLayer(1920, 800, [back, bottom1, bottom2, self.timer_layer]) page7 = dmd.GroupedLayer( 1920, 800, [back, bottom1, bottom2, bottom3, self.timer_layer]) page8 = dmd.GroupedLayer(1920, 800, [back, bottom2, bottom3, self.timer_layer]) page9 = dmd.GroupedLayer(1920, 800, [back, bottom3, self.timer_layer]) page10 = dmd.GroupedLayer(1920, 800, [back, top1, self.timer_layer]) page11 = dmd.GroupedLayer(1920, 800, [back, top1, top2, self.timer_layer]) self.main_layer = dmd.ScriptedLayer(1920, 800, [{ 'seconds': 1, 'layer': page1 }, { 'seconds': 0.2, 'layer': page2 }, { 'seconds': 0.2, 'layer': page3 }, { 'seconds': 0.5, 'layer': page4 }, { 'seconds': 0.2, 'layer': page5 }, { 'seconds': 0.2, 'layer': page6 }, { 'seconds': 1, 'layer': page7 }, { 'seconds': 0.2, 'layer': page8 }, { 'seconds': 0.2, 'layer': page9 }, { 'seconds': 0.5, 'layer': page4 }, { 'seconds': 0.2, 'layer': page10 }, { 'seconds': 0.2, 'layer': page11 }]) self.bogey_award_text = dmd.HDTextLayer(1920 / 2, 150, self.game.fonts['default'], "center", line_color=[64, 0, 0], line_width=6, interior_color=[192, 0, 0]) self.bogey_award_score = dmd.HDTextLayer(1920 / 2, 300, self.game.fonts['main_score'], "center", line_color=[64, 64, 0], line_width=6, interior_color=[192, 192, 0]) self.bogey_award_score_dim = dmd.HDTextLayer( 1920 / 2, 300, self.game.fonts['main_score'], "center", line_color=[16, 16, 0], line_width=6, interior_color=[64, 64, 0]) self.flash_text = dmd.ScriptedLayer( 1920, 800, [{ 'seconds': 0.2, 'layer': self.bogey_award_score }, { 'seconds': 0.2, 'layer': self.bogey_award_score_dim }])
def __init__(self, game, priority, left_text, right_text, entered_handler): super(HD_InitialEntryMode_ML, self).__init__(game, priority) self.entered_handler = entered_handler # self.init_font = dmd.font_named('Font09Bx7.dmd') # self.font = dmd.font_named('Font07x5.dmd') # self.letters_font = dmd.font_named('Font07x5.dmd') ## YOU almost CERTAINLY need to change these... self.init_font = self.game.fonts['large'] self.text_font = self.game.fonts['small'] self.letters_font = self.game.fonts['mono-tiny'] self.letters_font_mini = self.game.fonts['mono-micro'] self.init_font_height = self.init_font.size("Z")[1] self.text_font_height = self.text_font.size(left_text)[1] self.layer = dmd.GroupedLayer(self.display_width, self.display_height) self.layer.opaque = True self.layer.layers = [] if type(right_text) != list: right_text = [right_text] if type(left_text) != list: left_text = [left_text] seconds_per_text = 1.5 script = [] mh = 0 for text in left_text: words = text.split() h = self.text_font_height*len(words) mh = max(h, mh) frame = dmd.Frame(width=self.display_width, height=h) i = 0 for w in words: self.text_font.draw(frame, w, 0, i*self.text_font_height) i+=1 script.append({'seconds':seconds_per_text, 'layer':dmd.FrameLayer(frame=frame)}) topthird_left_layer = dmd.ScriptedLayer(width=self.display_width, height=mh, script=script) topthird_left_layer.composite_op = 'blacksrc' topthird_left_layer.target_y = self.display_height/2 - mh/2 topthird_left_layer.target_x = 10 self.layer.layers += [topthird_left_layer] script = [] mh = 0 for text in right_text: words = text.split() h = self.text_font_height*len(words) mh = max(h, mh) frame = dmd.Frame(width=self.display_width, height=h) i = 0 for w in words: self.text_font.draw(frame, w, self.display_width-(self.text_font.size(w)[0]), i*self.text_font_height) i+=1 script.append({'seconds':seconds_per_text, 'layer':dmd.FrameLayer(frame=frame)}) topthird_right_layer = dmd.ScriptedLayer(width=self.display_width, height=mh, script=script) topthird_right_layer.composite_op = 'blacksrc' topthird_right_layer.target_y = self.display_height/2 - mh/2 topthird_right_layer.target_x = -10 self.layer.layers += [topthird_right_layer] # the entered initials so far self.inits_layer = dmd.HDTextLayer(self.display_width/2, self.init_font_height/2+5, self.init_font, "center", vert_justify="center", line_color=(128,128,255), line_width=1, interior_color=(0,0,192),fill_color=(0,0,0)).set_text("") self.inits_layer.set_target_position(0, self.text_font_height+2) self.layer.layers += [self.inits_layer] self.letters = [] for idx in range(26): self.letters += [chr(ord('A')+idx)] self.letters += [' ', '.', self.char_back, self.char_done] self.current_letter_index = 0 self.inits = self.letters[self.current_letter_index] # Draw my fancy rows w = self.space_per_char*(self.columns_of_chars_in_palette+1) h = self.space_per_char*(30/self.columns_of_chars_in_palette+1.5) print("About to create a frame with w=" + str(w) + "; h=" + str(h)) self.char_optsF = dmd.Frame(width=w, height=h) for index in range(30): x = index % self.columns_of_chars_in_palette y = index / self.columns_of_chars_in_palette (w,h) = self.letters_font.size(self.letters[index]) if(index<28): self.letters_font.draw(self.char_optsF, self.letters[index], (x+1) * self.space_per_char - w/2, (y+1) * self.space_per_char - h/2) elif(index==28): (w,h) = self.letters_font_mini.size("DEL") self.letters_font_mini.draw(self.char_optsF, "DEL", (x+1) * self.space_per_char - w/2, (y+1) * self.space_per_char - h/2) elif(index==29): (w,h) = self.letters_font_mini.size("END") self.letters_font_mini.draw(self.char_optsF, "END", (x+1) * self.space_per_char - w/2, (y+1) * self.space_per_char - h/2) fbox = dmd.Frame(width=self.space_per_char+2, height=self.space_per_char+2) fbox.fill_rect(0, 0, self.space_per_char+2, self.space_per_char+2, (128,128,255)) fbox.fill_rect(2, 2, self.space_per_char-4+2, self.space_per_char-4+2, (0,64,128)) self.selection_box_layer = dmd.FrameLayer(opaque=False, frame=fbox) self.selection_box_layer.composite_op = "max" self.layer.layers += [self.selection_box_layer] self.char_opts_layer = dmd.FrameLayer(opaque=False, frame=self.char_optsF) self.char_opts_layer.set_target_position((self.display_width-(self.columns_of_chars_in_palette+1) * self.space_per_char)/2, self.init_font_height) # self.char_opts_layer.composite_op = "blacksrc" self.layer.layers += [self.char_opts_layer] self.animate_to_index(0)
def __init__(self, game, priority, left_text, right_text, entered_handler): super(HD_InitialEntryMode_ML, self).__init__(game, priority) self.entered_handler = entered_handler # self.init_font = dmd.font_named('Font09Bx7.dmd') # self.font = dmd.font_named('Font07x5.dmd') # self.letters_font = dmd.font_named('Font07x5.dmd') self.init_font = self.game.fonts['small'] self.text_font = self.game.fonts['large'] self.letters_font = self.game.fonts['med'] self.init_font_height = self.init_font.size("Z")[1] self.text_font_height = self.text_font.size("Z")[1] self.layer = dmd.GroupedLayer(480, 240) self.layer.opaque = True self.layer.layers = [] if type(right_text) != list: right_text = [right_text] if type(left_text) != list: left_text = [left_text] seconds_per_text = 1.5 script = [] for text in left_text: frame = dmd.Frame(width=450, height=self.text_font_height) self.text_font.draw(frame, text, 0, 0) script.append({'seconds':seconds_per_text, 'layer':dmd.FrameLayer(frame=frame)}) topthird_left_layer = dmd.ScriptedLayer(width=480, height=self.text_font_height, script=script) topthird_left_layer.composite_op = 'blacksrc' self.layer.layers += [topthird_left_layer] script = [] for text in right_text: frame = dmd.Frame(width=480, height=self.text_font_height) self.text_font.draw(frame, text, 480-(self.text_font.size(text)[0]), 0) script.append({'seconds':seconds_per_text, 'layer':dmd.FrameLayer(frame=frame)}) topthird_right_layer = dmd.ScriptedLayer(width=480, height=self.text_font_height, script=script) topthird_right_layer.composite_op = 'blacksrc' self.layer.layers += [topthird_right_layer] self.inits_frame = dmd.Frame(width=480, height=self.init_font_height) inits_layer = dmd.FrameLayer(opaque=False, frame=self.inits_frame) inits_layer.set_target_position(0, self.text_font_height+2) self.layer.layers += [inits_layer] self.lowerhalf_layer = dmd.FrameQueueLayer(opaque=False, hold=True) self.lowerhalf_layer.set_target_position(0, self.init_font_height+self.text_font_height) self.layer.layers += [self.lowerhalf_layer] self.letters = [] for idx in range(26): self.letters += [chr(ord('A')+idx)] self.letters += [' ', '.', self.char_back, self.char_done] self.current_letter_index = 0 self.inits = self.letters[self.current_letter_index] self.animate_to_index(0)
def __init__(self, game): super(IronMonger, self).__init__(game=game, priority=17, mode_type=AdvancedMode.Game) self.myID = "IronMonger" self.monger_lamps = [ self.game.lamps['mongerM'], self.game.lamps['mongerO'], self.game.lamps['mongerN'], self.game.lamps['mongerG'], self.game.lamps['mongerE'], self.game.lamps['mongerR'] ] self.orbit_lamps = [ self.game.lamps['leftOrbitMonger'], self.game.lamps['centerShotMonger'], self.game.lamps['rightOrbitMonger'] ] self.grunts = [ 'monger_grunt_1', 'monger_grunt_2', 'monger_grunt_3', 'monger_grunt_4', 'monger_grunt_5', 'monger_grunt_6' ] self.grunt_index = 0 self.delay_names = [ 'leftSpinner', 'centerSpinner', 'rightSpinner', 'leftOrbit', 'rightOrbit' ] layer0 = dmd.FrameLayer( frame=self.game.animations['monger_logo_0'].frames[0]) layer0.set_target_position(367, 0) layer1 = dmd.FrameLayer( frame=self.game.animations['monger_logo_1'].frames[0]) layer1.set_target_position(367, 0) layer2 = dmd.FrameLayer( frame=self.game.animations['monger_logo_2'].frames[0]) layer2.set_target_position(367, 0) layer3 = dmd.FrameLayer( frame=self.game.animations['monger_logo_3'].frames[0]) layer3.set_target_position(367, 0) layer4 = dmd.FrameLayer( frame=self.game.animations['monger_logo_4'].frames[0]) layer4.set_target_position(367, 0) layer5 = dmd.FrameLayer( frame=self.game.animations['monger_logo_5'].frames[0]) layer5.set_target_position(367, 0) layer6 = dmd.FrameLayer( frame=self.game.animations['monger_logo_6'].frames[0]) layer6.set_target_position(367, 0) layer7 = dmd.FrameLayer( frame=self.game.animations['monger_logo_7'].frames[0]) layer7.set_target_position(367, 0) layer8 = dmd.FrameLayer( frame=self.game.animations['monger_logo_8'].frames[0]) layer8.set_target_position(367, 0) layer9 = dmd.FrameLayer( frame=self.game.animations['monger_logo_9'].frames[0]) layer9.set_target_position(367, 0) layer10 = dmd.FrameLayer( frame=self.game.animations['monger_logo_10'].frames[0]) layer10.set_target_position(367, 0) self.logo_layers = [ layer0, layer1, layer2, layer3, layer4, layer5, layer6, layer7, layer8, layer9, layer10 ] self.points_layer = dmd.HDTextLayer(1920 / 2, 570, self.game.fonts['bebas200'], "center", line_color=(96, 96, 86), line_width=3, interior_color=(224, 224, 224)) self.monger_base_value = 100000 self.spinner_points = [0, 0, 0] self.spinner_names = ['left', 'right', 'center'] self.current_monger_value = 100000 # which spinner has the live display self.last_spinner = 0 self.cold = True self.spinner_anim = self.game.animations['monger_minigun_firing'] self.spinner_text_layer = dmd.HDTextLayer(1870, 30, self.game.fonts['bebas200'], "right", line_color=(96, 96, 86), line_width=3, interior_color=(224, 224, 224)) self.spinner_display = dmd.GroupedLayer( 1920, 800, [self.spinner_anim, self.spinner_text_layer], opaque=True) self.valid = [True, True, True, True, True, True] self.status = "OPEN" self.letters = 0 self.toy_letters = 0 # script sets for the orbit shots script0 = ['im_script0a', 'spinner_tutorial', 'im_script0b'] script1 = ['im_script1a', 'spinner_tutorial', 'im_script1b'] script2 = [ 'im_script2a', 'spinner_tutorial', 'im_script2b', 'im_script2c' ] script3 = [ 'im_script3a', 'spinner_tutorial', 'im_script3b', 'im_script3c' ] script4 = [ 'im_script4a', 'spinner_tutorial', 'im_script4b', 'im_script4c' ] script5 = ['spinner_tutorial', 'im_script5a', 'im_script5b'] self.first_scripts = [ script0, script1, script2, script3, script4, script5 ] self.first_scripts_index = 0 script1b = [ 'im_script7a', 'im_script7b', 'im_script7c', 'im_script7d', 'im_script7e' ] script2b = [ 'im_script8a', 'im_script8b', 'im_script8c', 'im_script8d', 'im_script8e' ] script3b = [ 'im_script9a', 'im_script9b', 'im_script9c', 'im_script9d', 'im_script9e', 'im_script9f', 'im_script9g' ] self.second_scripts = [script1b, script2b, script3b] self.second_scripts_index = 0