def finish_up(self): self.running = False self.game.stack_level(6, value=False, lamps=False) textLine1 = ep.EP_TextLayer(64, 4, self.game.assets.font_5px_AZ, "center", opaque=False).set_text("FINAL TOTALS:", color=ep.RED) playerCount = len(self.game.players) if playerCount == 1: playerLine1 = ep.EP_TextLayer( 64, 15, self.game.assets.font_7px_az, "center", opaque=False).set_text(str( ep.format_score(self.game.players[0].score)), color=ep.YELLOW) combined = dmd.GroupedLayer( 128, 32, [self.backdrop, textLine1, playerLine1]) elif playerCount == 2: playerLine1 = ep.EP_TextLayer( 64, 12, self.game.assets.font_5px_AZ, "center", opaque=False).set_text( "1) " + str(ep.format_score(self.game.players[0].score)), color=ep.YELLOW) playerLine2 = ep.EP_TextLayer( 64, 20, self.game.assets.font_5px_AZ, "center", opaque=False).set_text( "2) " + str(ep.format_score(self.game.players[1].score)), color=ep.YELLOW) combined = dmd.GroupedLayer( 128, 32, [self.backdrop, textLine1, playerLine1, playerLine2]) elif playerCount == 3: playerLine1 = ep.EP_TextLayer( 4, 12, self.game.assets.font_5px_AZ, "left", opaque=False).set_text( "1) " + str(ep.format_score(self.game.players[0].score)), color=ep.YELLOW) playerLine2 = ep.EP_TextLayer( 4, 20, self.game.assets.font_5px_AZ, "left", opaque=False).set_text( "2) " + str(ep.format_score(self.game.players[1].score)), color=ep.YELLOW) playerLine3 = ep.EP_TextLayer( 68, 12, self.game.assets.font_5px_AZ, "left", opaque=False).set_text( "3) " + str(ep.format_score(self.game.players[2].score)), color=ep.YELLOW) combined = dmd.GroupedLayer(128, 32, [ self.backdrop, textLine1, playerLine1, playerLine2, playerLine3 ]) else: playerLine1 = ep.EP_TextLayer( 4, 12, self.game.assets.font_5px_AZ, "left", opaque=False).set_text( "1) " + str(ep.format_score(self.game.players[0].score)), color=ep.YELLOW) playerLine2 = ep.EP_TextLayer( 4, 20, self.game.assets.font_5px_AZ, "left", opaque=False).set_text( "2) " + str(ep.format_score(self.game.players[1].score)), color=ep.YELLOW) playerLine3 = ep.EP_TextLayer( 68, 12, self.game.assets.font_5px_AZ, "left", opaque=False).set_text( "3) " + str(ep.format_score(self.game.players[2].score)), color=ep.YELLOW) playerLine4 = ep.EP_TextLayer( 68, 20, self.game.assets.font_5px_AZ, "left", opaque=False).set_text( "4) " + str(ep.format_score(self.game.players[3].score)), color=ep.YELLOW) combined = dmd.GroupedLayer(128, 32, [ self.backdrop, textLine1, playerLine1, playerLine2, playerLine3, playerLine4 ]) self.layer = combined self.delay("Operational", delay=3, handler=self.shutdown)
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 polly_died(self, step=1, drain=False): print "OMG POLLY IS DEAD" if step == 1: # turn off the polly indicator self.game.peril = False self.finishing_up = True # stop the train self.game.train.stop() #if we're showing the full animation, do that now if self.showDeathAnimation == 'Show': self.game.base.priority_quote(self.game.assets.quote_pollyStop) anim = self.game.assets.dmd_pollyMurder animLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=True, repeat=False, frame_time=6) myWait = len(anim.frames) / 10.0 self.layer = animLayer self.game.sound.play(self.game.assets.sfx_trainChugShort) self.delay(delay=myWait, handler=self.polly_died, param=2) # if not, just move on to polly finished else: 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.polly_finished) if step == 2: if self.running: backdrop = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_pollyMurder.frames[7]) awardTextTop = dmd.TextLayer( 128 / 2, 3, self.game.assets.font_5px_bold_AZ_outline, justify="center", opaque=False) awardTextBottom = dmd.TextLayer( 128 / 2, 11, self.game.assets.font_15px_az_outline, justify="center", opaque=False) awardTextBottom.composite_op = "blacksrc" awardTextTop.composite_op = "blacksrc" awardTextTop.set_text("POLLY") awardTextBottom.set_text("DIED") combined = dmd.GroupedLayer( 128, 32, [backdrop, awardTextTop, awardTextBottom]) self.layer = combined duration = self.game.sound.play(self.game.assets.sfx_glumRiff) self.delay("Display", delay=duration, handler=self.clear_layer) self.delay("Operational", delay=1.5, handler=self.polly_finished)
def update_display(self,once=False): # score line p = self.game.current_player() scoreString = ep.format_score(p.score) scoreLayer = ep.EP_TextLayer(64, 17, self.game.assets.font_9px_az, "center", opaque=False).set_text(scoreString,blink_frames=6,color=ep.DARK_GREEN) # if we're in ship mode, draw a combined layer of the ship and desert if self.mode == "SHIP": # if the saucer is moving - change it's position for the next pass if we haven't reached the target yet if self.saucerMoving: # tick over 3 spots - in the direction we're going if self.direction[0] == "LEFT": self.saucerX -= 3 else: self.saucerX += 3 # if we've made it to the destination spot, activate the shot if self.stopAt == self.saucerX: # saucer is not moving self.saucerMoving = False # set the next position if self.direction[0] == "LEFT": print "MOVING LEFT" self.position -= 1 else: print "MOVING RIGHT" self.position += 1 # activate the shot # off screen to the right if self.stopAt == self.positions[6]: self.switch_modes("ALIEN") return # right ramp elif self.stopAt == self.positions[5]: self.activate_shot(4) # right loop elif self.stopAt == self.positions[4]: self.activate_shot(3) # center ramp elif self.stopAt == self.positions[3]: self.activate_shot(2) # left ramp elif self.stopAt == self.positions[2]: self.activate_shot(1) # left loop elif self.stopAt == self.positions[1]: self.activate_shot(0) # off screen to the left elif self.stopAt == self.positions[0]: self.switch_modes("ALIEN") return else: print "WAT?" # set the position of the ship self.smallShip.set_target_position(self.saucerX,0) # then build and show the layer combined = dmd.GroupedLayer(128,32,[self.smallShip,self.desert,scoreLayer]) self.layer = combined if self.mode == "ALIEN": layers = [] # blackout layer layers.append(self.blankLayer) # add the backdrop layers.append(self.desert) # and teh score layers.append(scoreLayer) # add teleporting aliens if self.teleporting: for x in self.teleportingAliens: layers.append(x) else: # add any standing aliens for x in self.activeAliens: layers.append(self.alienLayers[x]) combined = dmd.GroupedLayer(128,32,layers) self.layer = combined # if we're in aliens mode draw the combined aliens and desert # loop back in 0.1 to update the display again if not once: self.delay("Display",delay=0.1,handler=self.update_display)
def hit(self, target): # reset the taunt timer self.tauntTimer = 0 # handle a guy hit in a showdown print "KILLING GUY: " + str(target) # count the dead guy self.death_tally += 1 # add one to the rolling high noon total self.game.increase_tracking('kills') # score points # after the 4th guy the point value goes up if self.death_tally > 4: self.showdownValue = 450000 self.game.score(self.showdownValue) # increase the running total by that amount self.game.increase_tracking('showdownPoints', self.showdownValue) # swap out the appropriate layer shotguy = self.game.assets.dmd_dudeShotFullBody if target == 0: # take out the current hit guy self.guyLayers.remove(self.badGuy0) self.badGuy0 = dmd.AnimatedLayer(frames=shotguy.frames, hold=True, opaque=False, repeat=False, frame_time=6) self.badGuy0.set_target_position(-49, 0) self.badGuy0.composite_op = "blacksrc" # append on the new layer to the end to put it in the front self.guyLayers.append(self.badGuy0) elif target == 1: # take out the current hit guy self.guyLayers.remove(self.badGuy1) self.badGuy1 = dmd.AnimatedLayer(frames=shotguy.frames, hold=True, opaque=False, repeat=False, frame_time=6) self.badGuy1.set_target_position(-16, 0) self.badGuy1.composite_op = "blacksrc" # append on the new layer to the end to put it in the front self.guyLayers.append(self.badGuy1) elif target == 2: # take out the current hit guy self.guyLayers.remove(self.badGuy2) self.badGuy2 = dmd.AnimatedLayer(frames=shotguy.frames, hold=True, opaque=False, repeat=False, frame_time=6) self.badGuy2.set_target_position(15, 0) self.badGuy2.composite_op = "blacksrc" # append on the new layer to the end to put it in the front self.guyLayers.append(self.badGuy2) else: # take out the current hit guy self.guyLayers.remove(self.badGuy3) self.badGuy3 = dmd.AnimatedLayer(frames=shotguy.frames, hold=True, opaque=False, repeat=False, frame_time=6) self.badGuy3.set_target_position(47, 0) self.badGuy3.composite_op = "blacksrc" # append on the new layer to the end to put it in the front self.guyLayers.append(self.badGuy3) myWait = len(shotguy.frames) / 10.0 # put the new layer in place combined = dmd.GroupedLayer(128, 32, self.guyLayers) combined.composite_op = "blacksrc" self.layer = combined # flash the guns self.game.base.guns_flash(1) # play a shot sound self.game.sound.play(self.game.assets.sfx_gunfightShot) # if the 4 dudes are dead, reset them myWait = len(shotguy.frames) / 10.0 if self.death_tally % 4 == 0: print "THEY'RE ALL DEAD JIM" self.delay("Operational", delay=myWait, handler=self.new_rack) # audit self.game.game_data['Feature']['Showdown Racks Clear'] += 1 else: self.delay("Operational", delay=myWait, handler=self.game.interrupter.showdown_hit, param=self.showdownValue)
def boss_target_hit(self, target): # remove this dude from the posse self.activeBossPosse.remove(target) self.game.base.play_quote(self.game.assets.quote_targetBossBart) self.animate(2) # cancel the main display self.cancel_delayed("Boss Display") # show a display of dude getting hit anim = self.game.assets.dmd_dudeShotShouldersUp animLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=False, repeat=False, frame_time=6) animLayer.composite_op = "blacksrc" textString = str(ep.format_score(25000)) pointsLayer = ep.EP_TextLayer(64, 1, self.game.assets.font_15px_az, "center", opaque=True).set_text(textString, blink_frames=4, color=ep.RED) textLine = ep.EP_TextLayer(64, 18, self.game.assets.font_5px_AZ, "center", opaque=False).set_text("BOSS SHOTS", color=ep.GREEN) textLine2 = ep.EP_TextLayer(64, 24, self.game.assets.font_5px_AZ, "center", opaque=False) if self.boss_alternate: string = "VALUE DECREASED" else: string = "VALUE INCREASED" textLine2.set_text(string, color=ep.GREEN) self.layer = dmd.GroupedLayer( 128, 32, [pointsLayer, textLine, textLine2, animLayer]) myWait = len(anim.frames) / 10.0 + 1 # play a shot sound self.game.sound.play(self.game.assets.sfx_quickdrawHit) # flash the guns self.game.base.guns_flash(1) # delay clearing display self.delay("Display", delay=myWait, handler=self.clear_layer) # count the dude self.deathTally += 1 # if death tally makes it to 4, kill the bossfight flag if self.deathTally >= 4: self.bossFight = False # score points - dudes worth 20,000 self.game.score(25000) if not self.boss_alternate: # increase the shot value and defeat value if not alternate scoring self.hitValue += 50000 self.hitString = locale.format("%d", self.hitValue, True) # Add commas self.defeatValue += 100000 self.defeatString = locale.format("%d", self.defeatValue, True) # Add commas
def intro(self,step=1): composite = None if step == 1 or step == 3 or step == 5 or step == 7 or step == 9: # burst wipe the current layer 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" if step == 1: duration2 = self.game.sound.play(self.game.assets.music_highNoonLead) self.delay(delay=duration2,handler=self.music_on,param=self.game.assets.music_highNoon) composite = dmd.GroupedLayer(128,32,[self.banner,animLayer]) if step == 3: composite = dmd.GroupedLayer(128,32,[self.badGuysLayer,animLayer]) if step == 5: composite = dmd.GroupedLayer(128,32,[self.timeLayer,animLayer]) if step == 7: composite = dmd.GroupedLayer(128,32,[self.jackpotLayer,animLayer]) if step == 9: composite = dmd.GroupedLayer(128,32,[self.luckLayer,animLayer]) self.layer = composite self.game.sound.play(self.game.assets.sfx_lightning2) # a flourish lampshow self.game.lampctrl.play_show(self.game.assets.lamp_highNoonFlash, repeat=False) # loop back for step 2 step += 1 self.delay(delay=myWait,handler=self.intro,param=step) elif step == 2 or step == 4 or step == 6 or step == 8 or step == 10: # burst in the next frame anim = self.game.assets.dmd_burstWipe2 myWait = len(anim.frames) / 15.0 + 1.5 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 4 animLayer.composite_op = "blacksrc" if step == 2: # set up the badguy layer to expose backdrop = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_singleCowboySidewaysBorder.frames[0]) textLayer1 = ep.EP_TextLayer(80, 1, self.game.assets.font_9px_az, "center", opaque=False).set_text("SHOOT",color=ep.RED) textLayer1.composite_op = "blacksrc" textLayer2 = ep.EP_TextLayer(80, 11, self.game.assets.font_9px_az, "center", opaque=False).set_text("20 BAD GUYS",color=ep.RED) textLayer3 = ep.EP_TextLayer(80, 21, self.game.assets.font_9px_az, "center", opaque=False).set_text("TO WIN",color=ep.GREEN) textLayer3.composite_op = "blacksrc" self.badGuysLayer = dmd.GroupedLayer(128,32,[backdrop,textLayer1,textLayer2,textLayer3]) # then combine it with the wipe composite = dmd.GroupedLayer(128,32,[self.badGuysLayer,animLayer]) if step == 4: # this is the next page to show - time given textLayer1 = ep.EP_TextLayer(64, 1, self.game.assets.font_6px_az, "center", opaque=False).set_text("30 SECONDS +",color=ep.YELLOW) textLayer2 = ep.EP_TextLayer(64, 8, self.game.assets.font_6px_az, "center", opaque=False) kills = self.game.show_tracking('kills') textLayer2.set_text(str(kills) + " KILLS =",color=ep.ORANGE) # set up the timer while we've got kills hand self.myTimer = 30 + kills # cap it at 60 seconds if self.myTimer > 60: self.myTimer = 60 textLayer3 = ep.EP_TextLayer(64, 15, self.game.assets.font_12px_az, "center", opaque=False) textLayer3.set_text(str(self.myTimer) + " SECONDS",color=ep.GREEN) self.timeLayer = dmd.GroupedLayer(128,32,[textLayer1,textLayer2,textLayer3]) # then combine it with the wipe composite = dmd.GroupedLayer(128,32,[self.timeLayer,animLayer]) if step == 6: backdrop = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_moneybagBorder.frames[0]) textLayer1 = ep.EP_TextLayer(80, 3, self.game.assets.font_9px_az, "center", opaque=False).set_text("JACKPOTS WORTH",color=ep.ORANGE) textLayer2 = ep.EP_TextLayer(80, 13, self.game.assets.font_12px_az, "center", opaque=False).set_text(str(ep.format_score(250000)),color=ep.GREEN) self.jackpotLayer = dmd.GroupedLayer(128,32,[backdrop,textLayer1,textLayer2]) # combine with burst composite = dmd.GroupedLayer(128,32,[self.jackpotLayer,animLayer]) if step == 8: self.luckLayer = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_goodLuck.frames[0]) composite = dmd.GroupedLayer(128,32,[self.luckLayer,animLayer]) if step == 10: displayLayer = self.display() composite = dmd.GroupedLayer(128,32,[displayLayer,animLayer]) self.layer = composite if step <= 9: step += 1 self.delay(delay=myWait,handler=self.intro,param=step) elif step == 10: print "SHOULD GET GOING NOW" self.delay(delay=myWait,handler=self.get_going)
def skillshot_award(self, switch=0): # stop the music self.stop_music(slice=1) # play the sound if self.selectedPrizes[5:] == "V": self.music_on(self.game.assets.music_tribute) else: self.game.sound.play(self.game.assets.sfx_flourish7) awardStringTop = None awardStringBottom = None # award the prize - if self.selectedPrizes[5:] == "C": self.game.score(10) awardStringTop = "BANK ROBBERY" awardStringBottom = "BOOST" # set the bank ramp to completed if self.easy: self.game.set_tracking('rightRampStage', 3) self.game.score(250000) self.game.add_bonus(100000) else: self.game.increase_tracking('rightRampStage') self.game.score(100000) self.game.add_bonus(50000) elif self.selectedPrizes[5:] == "D": self.game.score(20) # this one is the lock - going to be complicated # if no balls have been locked yet, this awards a free lock straight up # or if lock is lit, it locks the ball as well if self.game.show_tracking( 'ballsLockedTotal') == 0 or self.game.show_tracking( 'mineStatus') == "LOCK": # turn off the skillshot layer self.layer = None # run the lock ball routine self.game.mine.lock_ball(self.start_gameplay) return # Otherwise we have to check some things # if it's not lit, are two balls locked elif self.game.show_tracking('ballsLocked') == 2: # if they are, light multiball self.game.mine.light_multiball() # set the award text appropriately awardStringTop = "MULTIBALL" awardStringBottom = "IS LIT" # If we get here, this is not the first lock of the game # and the lock is not lit, and there are not 2 balls locked # so we just light the lock else: self.game.mine.light_lock() # and set the award text awardStringTop = "LOCK" awardStringBottom = "IS LIT" elif self.selectedPrizes[5:] == "E": # this one is the bounty self.layer = None self.game.saloon.light_bounty(self.start_gameplay) return elif self.selectedPrizes[5:] == "F": awardStringTop = "RIVER RESCUE" awardStringBottom = "BOOST" if self.easy: self.game.set_tracking('leftRampStage', 3) self.game.score(250000) self.game.add_bonus(100000) else: self.game.increase_tracking('leftRampStage') self.game.score(100000) self.game.add_bonus(50000) elif self.selectedPrizes[5:] == "G": # This one is the right loop awardStringTop = "TRICK SHOTS" awardStringBottom = "BOOST" if self.easy: self.game.set_tracking('rightLoopStage', 4) self.game.score(250000) self.game.add_bonus(100000) else: self.game.increase_tracking('rightLoopStage') self.game.score(100000) self.game.add_bonus(50000) elif self.selectedPrizes[5:] == "H": # This one is the quickdraw awardStringTop = "QUICK DRAW" awardStringBottom = "IS LIT" self.game.score(10000) self.game.add_bonus(2000) # turn on the right quickdraw self.game.base.light_quickdraw(1) elif self.selectedPrizes[5:] == "I": # this one is the left loop awardStringTop = "BUCK N BRONCO" awardStringBottom = "BOOST" if self.easy: self.game.set_tracking('leftLoopStage', 4) self.game.score(250000) self.game.add_bonus(100000) else: self.game.increase_tracking('leftLoopStage') self.game.score(100000) self.game.add_bonus(50000) elif self.selectedPrizes[5:] == "J": # audit self.game.game_data['Feature']['EB Lit Skillshot'] += 1 awardStringTop = "EXTRA BALL" awardStringBottom = "IS LIT" # turn off the skill shot layer self.layer = None # callback = None if self.super: # callback = self.start_gameplay self.kick = True self.game.mine.light_extra_ball(self.start_gameplay) return elif self.selectedPrizes[5:] == "K": # this one is the rank awardStringTop = "RANK INCREASED" # call the rank increase, which returns title and time newRank, duration = self.game.badge.increase_rank() awardStringBottom = "TO " + newRank elif self.selectedPrizes[5:] == "L": self.game.score(1000, bonus=True) awardStringTop = "BONUS X" awardStringBottom = "INCREASED +3" self.game.increase_tracking('bonusX', 3) elif self.selectedPrizes[5:] == "M": awardStringTop = "TRAIN RESCUE" awardStringBottom = "BOOST" if self.easy: self.game.set_tracking('centerRampStage', 3) self.game.score(250000) self.game.add_bonus(100000) else: self.game.increase_tracking('centerRampStage') self.game.score(100000) self.game.add_bonus(50000) # new 100 grand award elif self.selectedPrizes[5:] == "X": awardStringTop = ep.format_score(100000) awardStringBottom = "POINTS" self.game.score(100000) # the 1 million prize elif self.selectedPrizes[5:] == "N": self.game.score(1000000) self.game.add_bonus(2370) # setup the wipe animation and the text layer topText = dmd.TextLayer(128 / 2, 2, self.game.assets.font_5px_bold_AZ, "center", opaque=True).set_text("ONE", blink_frames=5) million = ep.EP_TextLayer(128 / 2, 9, self.game.assets.font_20px_az, "center", opaque=False).set_text("MILLION", blink_frames=5, color=ep.ORANGE) anim = self.game.assets.dmd_cashWipe wipeLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=False, repeat=False, frame_time=6) wipeLayer.composite_op = "blacksrc" self.layer = dmd.GroupedLayer(128, 32, [topText, million, wipeLayer]) self.game.sound.play(self.game.assets.sfx_thrownCoins) self.game.sound.play(self.game.assets.sfx_yeeHoo) self.delay(delay=1.6, handler=self.clear_layer) # start gameplay after the delay self.delay("Gameplay Start", delay=1.6, handler=self.start_gameplay) return # super prizes # three million elif self.selectedPrizes[5:] == "O": self.game.score(3000000) self.game.add_bonus(6930) # setup the wipe animation and the text layer topText = dmd.TextLayer(128 / 2, 2, self.game.assets.font_5px_bold_AZ, "center", opaque=True).set_text("THREE", blink_frames=5) million = ep.EP_TextLayer(128 / 2, 9, self.game.assets.font_20px_az, "center", opaque=False).set_text("MILLION", blink_frames=5, color=ep.ORANGE) anim = self.game.assets.dmd_cashWipe wipeLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=False, repeat=False, frame_time=6) wipeLayer.composite_op = "blacksrc" self.layer = dmd.GroupedLayer(128, 32, [topText, million, wipeLayer]) self.game.sound.play(self.game.assets.sfx_thrownCoins) self.game.sound.play(self.game.assets.sfx_yeeHoo) self.kick = True self.delay("Gameplay Start", delay=1.6, handler=self.start_gameplay) return # bonus x elif self.selectedPrizes[5:] == "P": self.game.score(1000, bonus=True) awardStringTop = "BONUS X" awardStringBottom = "INCREASED +5" self.game.increase_tracking('bonusX', 5) self.kick = True # gunfight elif self.selectedPrizes[5:] == "Q": # This one is the gunfight self.layer = None self.game.score(50000) self.game.add_bonus(1200) self.super = False self.kick = True self.game.saloon.light_gunfight( self.game.skill_shot.start_gameplay) return # drunk multiball elif self.selectedPrizes[5:] == "R": self.layer = None self.game.score(50000) self.game.add_bonus(1200) # light the dmb self.kick = True self.game.base.light_drunk_multiball( self.game.skill_shot.start_gameplay) return # move your train elif self.selectedPrizes[5:] == "S": awardStringTop = "MOVE" awardStringBottom = "YOUR TRAIN" # load the mode so the train starts moving self.game.modes.add(self.game.move_your_train) # if we hit the left loop, call start for MYT after a delay self.kick = True if switch == 1: self.delay("Operational", delay=1.5, handler=self.game.move_your_train.start) self.super = False # cva elif self.selectedPrizes[5:] == "T": awardStringTop = "COWBOYS" awardStringBottom = "VS ALIENS" self.game.set_tracking("cvaStatus", "READY") self.super = False if switch == 3: #if cva is hit on the mine, clear the skillshot display - backup for switches failing #self.clear_layer() self.game.mountain.busy = True self.game.modes.add(self.game.cva) self.game.cva.intro(entry="mine") # unload skillshot after 2 seconds #self.delay(2,handler=self.unload) return # marshall multiball elif self.selectedPrizes[5:] == "U": awardStringTop = "MARSHALL" awardStringBottom = "MULTIBALL" self.game.base.kickoff_marshall(True) self.kick = True self.super = False # Tribute mode elif self.selectedPrizes[5:] == "V": awardStringTop = "THIS IS JUST" awardStringBottom = "A TRIBUTE" self.game.modes.add(self.game.tribute_launcher) self.game.tribute_launcher.shot = self.wasActive print "Tribute Shot Set to: " + str( self.game.tribute_launcher.shot) self.super = False # franks n beans elif self.selectedPrizes[5:] == "W": awardStringTop = "FRANKS N" awardStringBottom = "BEANS" self.game.base.start_franks() # flip count + 5 elif self.selectedPrizes[5:] == "Y": awardStringTop = "FIVE EXTRA" awardStringBottom = "FLIPS ADDED" self.game.increase_tracking('Flip Limit', 5) # flip count + 10 elif self.selectedPrizes[5:] == "Z": awardStringTop = "TEN EXTRA" awardStringBottom = "FLIPS ADDED" self.game.increase_tracking('Flip Limit', 10) # flip count + 15 elif self.selectedPrizes[5:] == "a": awardStringTop = "FIFTEEN EXTRA" awardStringBottom = "FLIPS ADDED" self.game.increase_tracking('Flip Limit', 15) # call the lamp update so the prize is shown properly self.lamp_update() print "SkillShot Awarded " + str(self.selectedPrizes[5:]) + ": " + str( awardStringTop) + " " + str(awardStringBottom) self.award_display(awardStringTop, awardStringBottom)
def activate_super(self): # turn on a busy flag self.is_busy() # cancel the idle timer from interrupter jones self.game.interrupter.cancel_idle() # turn off the music self.stop_music(slice=1) # turn off the table lights self.game.set_tracking('lampStatus', "OFF") self.lamp_update() # pick a jackpot choices = [1, 2, 3, 4] self.active = random.choice(choices) # then update the local lamps self.super_update_lamps() # kick the flag self.super = True # pick the new prizes self.generate_prizes() # load the switch filter self.game.modes.add(self.game.super_filter) anim1 = self.game.assets.dmd_superBlink anim2 = self.game.assets.dmd_superSkillShot # math out the wait myWait = len(anim2.frames) / 20.0 # set the animation animLayer = ep.EP_AnimatedLayer(anim2) animLayer.hold = True animLayer.frame_time = 3 animLayer.add_frame_listener(16, self.game.sound.play, param=self.game.assets.sfx_ropeCreak) animLayer.add_frame_listener(20, self.game.sound.play, param=self.game.assets.sfx_slide) animLayer.composite_op = "blacksrc" # and the 'super' text layer blinkLayer = ep.EP_AnimatedLayer(anim1) blinkLayer.hold = True blinkLayer.frame_time = 3 blinkLayer.add_frame_listener(2, self.game.sound.play, param=self.game.assets.sfx_bountyBell) blinkLayer.add_frame_listener(14, self.game.sound.play, param=self.game.assets.sfx_bountyBell) combined = dmd.GroupedLayer(128, 32, [blinkLayer, animLayer]) # play a lasso throw sound self.game.sound.play(self.game.assets.sfx_ropeWoosh) # turn it on self.layer = combined self.play_ordered_quote(self.game.assets.quote_superSkillShot, 'super') self.delay(delay=myWait, handler=self.music_on, param=self.game.assets.music_drumRoll) # show the prizes self.delay(name="Display", delay=myWait + 1, handler=self.update_layer) self.delay(delay=myWait + 1, handler=self.unbusy)
def __init__(self, game, priority, left_text, right_text, entered_handler): super(HD_InitialEntryMode, 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=480, 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, priority, left_text, right_text, entered_handler): super(HD_InitialEntryMode, 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 self.char_optsF = dmd.Frame( width=self.space_per_char * (self.columns_of_chars_in_palette + 1), height=self.space_per_char * (30 / self.columns_of_chars_in_palette + 1.5)) 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) 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] fbox = dmd.Frame(width=self.space_per_char, height=self.space_per_char) fbox.fill_rect(0, 0, self.space_per_char, self.space_per_char, (128, 128, 255)) fbox.fill_rect(2, 2, self.space_per_char - 4, self.space_per_char - 4, (0, 0, 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.animate_to_index(0)
def in_progress(self): if self.running: #print "IN PROGRESS " + str(self.modeTimer) #print "Shooter info: Target - " + str(self.shotTarget) + " Timer - " + str(self.shotTimer) # and all the text p = self.game.current_player() scoreString = ep.format_score(p.score) scoreLine = dmd.TextLayer(34, 6, self.game.assets.font_5px_bold_AZ, "center", opaque=False).set_text(scoreString, blink_frames=8) timeString = str(int(self.modeTimer)) self.timeLine = dmd.TextLayer(128, 26, self.game.assets.font_5px_AZ, "right", opaque=False).set_text(timeString) # stick together the animation and static text with the dynamic text composite = dmd.GroupedLayer(128, 32, [ self.dude0Layer, self.dude1Layer, self.dude2Layer, self.foreground, self.timeLine ]) self.layer = composite # increment the shot timer self.shotTimer += 1 # check if time to shoot if self.shotTimer == self.shotTarget: # if it is that time, generate a firing guy self.dude_shoots() # did we just kill the last guy? if self.have_won: # self.have_won = False # delay for the dude getting shot animation to finish self.delay("Mode Timer", delay=self.deathWait, handler=self.polly_saved) # how about any guy? if self.banner: self.banner = False # if we need to show a dude killed banner, do that self.delay("Mode Timer", delay=self.deathWait, handler=self.banner_display) # is a guy shooting? if self.shooting: self.shooting = False # set a delay to put the plain guy back after self.delay("Mode Timer", delay=self.shotWait, handler=self.end_shot_sequence) # both of those bail before ticking down the timer and looping back ## tick down the timer self.modeTimer -= 0.1 ## hurry quote at 5 seconds, plead at 15 if abs(self.modeTimer - 15) < 0.00000001: self.game.base.play_quote(self.game.assets.quote_pollyPlead) if abs(self.modeTimer - 5) < 0.00000001: self.game.base.play_quote(self.game.assets.quote_pollyHurry) if self.modeTimer <= 0: # go to a grace period self.polly_died() # otherwise ... else: if not self.have_won: # set up a delay to come back in 1 second with the lowered time self.delay(name="Mode Timer", delay=0.1, handler=self.in_progress)
def start_gunfight(self,side): # audit self.game.game_data['Feature']['Gunfights Started'] += 1 self.starting = True print "GUNFIGHT GOES HERE" # pop up the post print "RAISE POST ON SIDE: " + str(side) self.activeSide = side self.posts[self.activeSide].patter(on_time=2,off_time=6,original_on_time=60) # cancel any other displays for mode in self.game.ep_modes: if getattr(mode, "abort_display", None): mode.abort_display() # set the level 1 stack flag self.game.stack_level(0,True) # turn off the lights self.game.set_tracking('lampStatus',"OFF") self.game.gi_control("OFF") self.game.lamp_control.disable_bad_guys() self.game.lamp_control.disable_bonus_lanes() self.lamp_update() if side == 0 and not self.game.lamp_control.lights_out: self.game.lamps.leftGunfightPin.schedule(0x00FF00FF) else: if not self.game.lamp_control.lights_out: self.game.lamps.rightGunfightPin.schedule(0x00FF00FF) self.game.increase_tracking('gunfightsStarted') # set the bad guy pop order accounting for the side it started on badGuys = [0,1,2,3] # select our eventual target # 0 is the left side, it shouldn't use target 1 if side == 0: enemy = random.randrange(1,4,1) # 1 is the right side, it shouldn't use target 3 else: enemy = random.randrange(0,3,1) # scramble the list random.shuffle(badGuys) # pull out the enemey print "ENEMY: " + str(enemy) # save the final target self.enemy = enemy print badGuys badGuys.remove(enemy) # and tag them on the end badGuys.append(enemy) print badGuys # stop the music # only kill the music if there's not a higher level running self.stop_music(slice=1) # play the intro riff myWait = self.game.sound.play(self.game.assets.music_gunfightIntro) # delayed play the drum roll self.delay("Operational",delay=myWait,handler=self.music_on,param=self.game.assets.music_drumRoll) # play a quote self.play_ordered_quote(self.game.assets.quote_gunfightStart,'start') # display the clouds with gunfight text if self.game.user_settings['Gameplay (Feature)']['Gunfight Mountain'] == 'Green': thecolor = ep.ORANGE else: thecolor = ep.RED title = ep.EP_TextLayer(64, 5, self.game.assets.font_20px_az, "center", opaque=False).set_text("Gunfight",color=thecolor) title.composite_op = "blacksrc" backdrop = dmd.FrameLayer(opaque=True, frame=self.game.assets.dmd_gunfightPan.frames[0]) mask = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_gunfightMask.frames[0]) mask.composite_op = "blacksrc" self.layer = dmd.GroupedLayer(128,32,[backdrop,mask,title]) # after a delay pan down to the dude self.delay("Operational",delay = 1.5,handler=self.gunfight_pan,param=badGuys)
def intro_display(self, step=1): ## show some junk about how the mode works if step == 1: flippers = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_flippers1.frames[0]) arrow = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_flippers1.frames[0]) elif step == 2 or step == 4 or step == 6 or step == 8 or step == 10: flippers = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_flippers2.frames[0]) arrowOne = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_rightArrow1.frames[0]) arrowTwo = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_rightArrow2.frames[0]) arrowThree = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_rightArrow3.frames[0]) arrow = dmd.ScriptedLayer(128, 32, [{ 'seconds': 0.15, 'layer': arrowOne }, { 'seconds': 0.15, 'layer': arrowTwo }, { 'seconds': 0.15, 'layer': arrowThree }]) arrow.composite_op = "blacksrc" elif step == 3 or step == 5 or step == 7 or step == 9: flippers = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_flippers3.frames[0]) arrowOne = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_leftArrow1.frames[0]) arrowTwo = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_leftArrow2.frames[0]) arrowThree = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_leftArrow3.frames[0]) arrow = dmd.ScriptedLayer(128, 32, [{ 'seconds': 0.15, 'layer': arrowOne }, { 'seconds': 0.15, 'layer': arrowTwo }, { 'seconds': 0.15, 'layer': arrowThree }]) arrow.composite_op = "blacksrc" else: # just to make the syntax checking happy flippers = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_flippers1.frames[0]) arrow = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_flippers1.frames[0]) flippers.composite_op = "blacksrc" text = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_reverse.frames[0]) if step == 2: self.game.base.play_quote(self.game.assets.quote_drunkNeverSeen) if step == 1: combined = dmd.GroupedLayer(128, 32, [text, flippers]) elif step == 2 or step == 3: combined = dmd.GroupedLayer(128, 32, [text, flippers, arrow]) else: combined = dmd.GroupedLayer(128, 32, [self.underLayer, flippers, arrow]) self.layer = combined if step <= 5: self.delay("Operational", delay=1, handler=self.intro_display, param=step + 1) else: self.delay("Operational", delay=1, handler=self.get_going)
def damage(self, saloonHit=False): print "DAMAGE BART" # log the hit in audits self.game.game_data['Feature']['Bart Hits'] += 1 # play a quote appropriate to the current bart #self.game.base.priority_quote(self.hitQuote,squelch=True) self.play_ordered_quote(self.hitQuote, 'hit', priority=True, squelch=True) # move bart self.animate(1) # score the points ## new thing for alternate rules for boss bart # if alternate boss version - multiply points by bad guys and update the string if self.boss_alternate and self.brother == "BOSS": points = self.hitValue * (self.game.bad_guys.count_active() + 1) self.game.score(points) self.hitString = locale.format("%d", points, True) else: self.game.score(self.hitValue) # add some bonus self.game.add_bonus(25000) # flash the light and move the dude # a flourish lampshow self.game.lampctrl.play_show(self.game.assets.lamp_sparkle, repeat=False, callback=self.lamp_update) # display the info # register the hit # increase the hits on bart - and store the new amount currentHits = self.game.increase_tracking('bartHits') # check to see if we're on the last hit now - meaning, our hit total is one less than defeat # math the remaining hits print "HITS FOR THIS BART: " + str(self.hitsThisBart) print "CURRENT HITS: " + str(currentHits) if currentHits > self.hitsThisBart: self.hitsThisBart = currentHits hitsLeft = self.hitsThisBart - currentHits if hitsLeft <= 1: # if it is, set the status to last self.game.set_tracking('bartStatus', "LAST") theText = str(hitsLeft) + " MORE HITS" if self.brother == "BOSS": offset = 40 else: offset = 38 textLayer1 = ep.EP_TextLayer(offset, 1, self.game.assets.font_7px_bold_az, justify="center", opaque=False).set_text(self.nameLine, color=ep.BROWN) textLayer2 = ep.EP_TextLayer(offset, 9, self.game.assets.font_7px_bold_az, justify="center", opaque=False).set_text(str( self.hitString)) textLayer3 = ep.EP_TextLayer(offset, 17, self.game.assets.font_6px_az, justify="center", opaque=False).set_text(theText, color=ep.YELLOW) textLayer4 = ep.EP_TextLayer(offset, 24, self.game.assets.font_6px_az, justify="center", opaque=False).set_text("TO COLLECT", color=ep.YELLOW) self.textLayer = dmd.GroupedLayer( 128, 32, [textLayer1, textLayer2, textLayer3, textLayer4]) self.textLayer.composite_op = "blacksrc" # play a fancy lamp show self.game.lampctrl.play_show(self.game.assets.lamp_sparkle, False, self.lamp_update) # if we're boss fighting, go to that display if self.brother == "BOSS": self.boss_damage_display() else: self.display_damage_one()
def award_bounty(self): # setup the award # make this false unless set otherwise self.prizeVal = False prizeText2 = None # set a prizeHandler and prizeParam based on bounty for use later if self.bountyPrize == 'extraBall': # audit self.game.game_data['Feature']['EB Lit Bounty'] += 1 prizeText = "EXTRA BALL" prizeText2 = "IS LIT" self.prizeHandler = self.game.mine.light_extra_ball self.prizeParam = False elif self.bountyPrize == 'lightGunFight': prizeText = "GUNFIGHT" prizeText2 = "IS LIT" self.prizeHandler = self.light_gunfight self.prizeParam = False elif self.bountyPrize == 'lightQuickdraw': prizeText = "QUICKDRAW" prizeText2 = "IS LIT" self.prizeHandler = self.game.base.light_quickdraw # have to figure out which quickdraw to light if self.game.show_tracking('quickdrawStatus', 0) != "READY": self.prizeParam = 0 else: self.prizeParam = 1 elif self.bountyPrize == 'awardLock': prizeText = "ADVANCE MINE" if self.game.show_tracking('mineStatus') == "OPEN": self.prizeHandler = self.game.mine.light_lock else: self.prizeHandler = self.game.mine.lock_ball self.prizeParam = False elif self.bountyPrize == 'bonusX': prizeText = "+5 BONUS X" self.prizeHandler = self.game.increase_tracking self.prizeParam = 'bonusX' self.prizeVal = 5 elif self.bountyPrize == 'rank': prizeText = "RANK" prizeText2 = "INCREASED" self.prizeHandler = self.game.badge.increase_rank self.prizeParam = False elif self.bountyPrize == 'points250k': prizeText = str(ep.format_score(250000)) self.prizeHandler = self.game.score self.prizeParam = 250000 elif self.bountyPrize == 'points500k': prizeText = str(ep.format_score(500000)) self.prizeHandler = self.game.score self.prizeParam = 500000 elif self.bountyPrize == 'points1Mil': prizeText = str(ep.format_score(1000000)) self.prizeHandler = self.game.score self.prizeParam = 1000000 elif self.bountyPrize == 'moveYourTrain': prizeText = "MOVE" prizeText2 = "YOUR TRAIN" # load the MYT mode to move the train and set up self.game.modes.add(self.game.move_your_train) # set the handler to the start of MYT self.prizeHandler = self.game.move_your_train.start # null the param flag self.prizeParam = False elif self.bountyPrize == 'ballSave': prizeText = "30 SEC" prizeText2 = "BALL SAVER" self.game.trough.start_ball_save(num_balls_to_save=1, time=30, now=True, allow_multiple_saves=False) self.prizeParam = 10000 self.prizeHandler = self.game.score elif self.bountyPrize == 'franksNBeans': prizeText = "FRANKS N" prizeText2 = "BEANS" self.delay(delay=3, handler=self.game.base.start_franks) self.prizeParam = 10000 self.prizeHandler = self.game.score else: prizeText = "WTF" print "WTF BOUNTY: " + self.bountyPrize # load the animation # set up the layer animLayer = ep.EP_AnimatedLayer(self.game.assets.dmd_bountyCollected) animLayer.composite_op = "blacksrc" animLayer.frame_time = 6 animLayer.hold = True # calculate a wait time with some buffer after to leave the text myWait = (len(self.game.assets.dmd_bountyCollected.frames) / 10) + 2 # set the backdrop for the revealed award backdrop = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_moneybagBorder.frames[0]) # set the text for the award awardTextTop = dmd.TextLayer(76, 3, self.game.assets.font_9px_az, justify="center", opaque=False) awardTextTop.set_text("YOUR BOUNTY:") awardTextTop.composite_op = "blacksrc" if prizeText2 != None: awardTextMiddle = ep.EP_TextLayer(76, 15, self.game.assets.font_6px_az, justify="center", opaque=False) awardTextBottom = ep.EP_TextLayer( 76, 24, self.game.assets.font_5px_bold_AZ, justify="center", opaque=False) awardTextMiddle.set_text(prizeText, color=ep.GREEN) awardTextMiddle.composite_op = "blacksrc" awardTextBottom.set_text(prizeText2, color=ep.GREEN) self.layer = dmd.GroupedLayer(128, 32, [ backdrop, awardTextBottom, awardTextMiddle, awardTextTop, animLayer ]) else: awardTextMiddle = ep.EP_TextLayer(76, 17, self.game.assets.font_9px_az, justify="center", opaque=False) awardTextMiddle.set_text(prizeText, color=ep.GREEN) self.layer = dmd.GroupedLayer( 128, 32, [backdrop, awardTextMiddle, awardTextTop, animLayer]) # play a lampshow self.game.lampctrl.play_show(self.game.assets.lamp_topToBottom, repeat=False, callback=self.lamp_update) # play the quote self.game.base.priority_quote(self.game.assets.quote_bountyCollected) # then clear the layer and kick the ball out self.delay(delay=myWait, handler=self.finish_up)
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 start_quickdraw(self, side): # audit self.game.game_data['Feature']['Quickdraws Started'] += 1 # set the stack flag self.game.stack_level(0, True) # cancel any other displays for mode in self.game.ep_modes: if getattr(mode, "abort_display", None): mode.abort_display() self.side = side # tick up the started stat self.game.increase_tracking('quickdrawsStarted') print "STARTING QUICKDRAW ON SIDE:" + str(side) # set the status of this side to running self.game.set_tracking('quickdrawStatus', "RUNNING", side) # figure out the available bad guys choices = [] count = 0 for x in self.game.show_tracking('badGuysDead'): if not x: choices.append(count) count += 1 print "AVAILABLE BAD GUYS" print choices # pick one of them at random self.target = random.choice(choices) print "BAD GUY ACTIVE IS: " + str(self.target) # start the mode music self.game.sound.play(self.game.assets.music_quickdrawBumper) self.delay("Operational", delay=1.3, handler=self.music_on, param=self.game.assets.music_quickdraw) # play a quote self.game.base.play_quote(self.game.assets.quote_quickdrawStart) # pop that sucker up self.game.bad_guys.target_up(self.target) # Set up the display anim = self.game.assets.dmd_quickdrawStart self.animLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=True, repeat=False, frame_time=6) # set the end time based on the config setting # set up the point value value = [500000, 750000, 1000000, 1500000, 2000000] # based on rank rank = self.game.show_tracking('rank') self.points = value[rank] scoreLayer = ep.EP_TextLayer(84, 4, self.game.assets.font_12px_az, "center", opaque=False) scoreLayer.set_text(ep.format_score(self.points), color=ep.YELLOW) # combine the score and animation and turn it on self.layer = dmd.GroupedLayer(128, 32, [self.animLayer, scoreLayer]) # read the run time from the settings self.runtime = self.game.user_settings['Gameplay (Feature)'][ 'Quickdraw Timer'] self.third = self.runtime / 3.0 # set the amount to subtract per 5th of a second # I hope this is right - divide the points by 10, divide by 5 times the amount of # seconds, times 10 again to get an even number # then take off 370 to get a more interesting countdown self.portion = ((self.points / 10) / int(self.runtime * 5) * 10) - 370 # queue up a delay for when the timer should run out if the mode hasn't been won # then start the timer after a 1 second grace period self.delay("Grace", delay=1.5, handler=self.timer, param=self.target)
def boss_display_two(self): self.layer = dmd.GroupedLayer(128, 32, [self.faceFrame, self.textLayer]) # delay a loop back to the boss display self.delay("Boss Display", delay=2, handler=self.clear_layer) self.delay(delay=2, handler=self.game.saloon.unbusy)
def won(self, target): # update the bad guys self.game.set_tracking('badGuysDead', "True", target) self.update_tracking() # audit self.game.game_data['Feature']['Quickdraws Won'] += 1 # kill the timer self.cancel_delayed("Grace") self.cancel_delayed("Timer Delay") # kill the mode music print "QUICKDRAW WON IS KILLING THE MUSIC" # add one to the total dead self.game.increase_tracking('kills') # and tick up the quickdraw wins dudesDead = self.game.increase_tracking('quickdrawsWon') # only kill the music if there's not a higher level running self.stop_music(slice=1) # play the win animation anim = self.game.assets.dmd_quickdrawHit animLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=True, repeat=False, frame_time=6) # setup the text scoreLayer = ep.EP_TextLayer(84, 4, self.game.assets.font_12px_az, "center", opaque=False) scoreLayer.set_text(ep.format_score(self.points), color=ep.GREEN) # combine and activate textLayer = ep.EP_TextLayer(84, 20, self.game.assets.font_7px_bold_az, "center", opaque=False) textLayer.set_text("QUICK DRAW!", color=ep.GREEN) self.game.sound.play(self.game.assets.sfx_quickdrawHit) self.game.sound.play(self.game.assets.sfx_quickdrawFinale) self.game.sound.play(self.game.assets.sfx_cheers) stackLevel = self.game.show_tracking('stackLevel') winLayer = dmd.GroupedLayer(128, 32, [animLayer, scoreLayer, textLayer]) # if something higher is running, throw the win display in a cut in if True in stackLevel[1:]: self.game.interrupter.cut_in(winLayer, 1) else: self.layer = winLayer myWait = len(anim.frames) / 10.0 + 2 # stuff specific to winning # score the points self.game.score(self.points) # add some bonus self.game.add_bonus(50000) self.lamp_update() # stall a bit, then do the rest of the winning self.delay("Operational", delay=0.5, handler=self.finish_win, param=dudesDead)
def tally(self,title,amount,value,frame_delay,callback,step): script = [] # set the backdrop and offsets if title == "JACKPOT": backdrop = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_moneybagBorderRight.frames[0]) x_offset = 50 elif title == "BAD GUY": backdrop = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_singleCowboyBorderRight.frames[0]) x_offset = 50 else: backdrop = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_blank.frames[0]) x_offset = 64 # first just the title titleLine = ep.EP_TextLayer(x_offset, 10, self.game.assets.font_12px_az, "center", opaque=False).set_text(title + "S",color=ep.ORANGE) combined = dmd.GroupedLayer(128,32,[backdrop,titleLine]) script.append({"layer":combined,"seconds":0.5}) myWait = 0.5 # have to define pointsLine and TitleLine just in case it's zero titleString = "0 " + title + "S" titleLine = ep.EP_TextLayer(x_offset,3,self.game.assets.font_7px_az, "center", opaque=False).set_text(titleString,color=ep.BROWN) points = 0 pointsLine = ep.EP_TextLayer(x_offset, 12, self.game.assets.font_12px_az, "center", opaque=False).set_text(ep.format_score(points),color=ep.ORANGE) combined = dmd.GroupedLayer(128,32,[backdrop,titleLine,pointsLine]) script.append({"layer":combined,"seconds":frame_delay}) # then generate frames for each level of title for i in range(1,amount+1,1): points = i * value if i == 1: titleString = "1 " + title else: titleString = str(i) + " " + title + "S" titleLine = ep.EP_TextLayer(x_offset,3,self.game.assets.font_7px_az, "center", opaque=False).set_text(titleString,color=ep.BROWN) pointsLine = ep.EP_TextLayer(x_offset, 12, self.game.assets.font_12px_az, "center", opaque=False).set_text(ep.format_score(points),color=ep.ORANGE) combined = dmd.GroupedLayer(128,32,[backdrop,titleLine,pointsLine]) script.append({"layer":combined,"seconds":frame_delay}) myWait += frame_delay # set a sound for this point at the start of the wipe #self.delay(name="Display",delay=myWait,handler=self.game.sound.play,param=self.game.assets.sfx_lightning2) # employ the burst wipe anim = self.game.assets.dmd_burstWipe animWait = len(anim.frames) / 15.0 myWait += animWait animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 4 animLayer.composite_op = "blacksrc" # add the burst burstLayer = dmd.GroupedLayer(128,32,[combined,animLayer]) script.append({"layer":burstLayer,"seconds":animWait}) # then a final total with the second half of the wipe anim = self.game.assets.dmd_burstWipe2 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold = True animLayer.frame_time = 4 animLayer.composite_op = "blacksrc" # set another sound to play after the anim myWait += animWait #self.delay(name="Display",delay=myWait,handler=self.game.sound.play,param=self.game.assets.sfx_cheers) if step == 2: preString = "JACKPOTS " elif step == 3: preString = "BAD GUYS " else: preString = "" titleLine = ep.EP_TextLayer(x_offset,3,self.game.assets.font_7px_az, "center", opaque=False).set_text(preString + "TOTAL:",color=ep.BROWN) combined = dmd.GroupedLayer(128,32,[backdrop,titleLine,pointsLine,animLayer]) script.append({"layer":combined,"seconds":(animWait + 2)}) # tack on that extra second myWait += 1 # then set off the layer self.layer = dmd.ScriptedLayer(128,32,script) # add the points to the grand total self.grandTotal += points # and delay the comeback for step 2 print "TALLY LOOP STEP " + str(step) self.delay(name="Display",delay=myWait+1.5,handler=callback,param=step)
def __init__(self, game): super(MongerMultiball, self).__init__(game=game, priority=51, mode_type=AdvancedMode.Manual) self.myID = "MongerMultiball" self.running = False self.loop_count = 0 self.monger_lamps = [ "Placeholder", self.game.lamps['mongerM'], self.game.lamps['mongerO'], self.game.lamps['mongerN'], self.game.lamps['mongerG'], self.game.lamps['mongerE'], self.game.lamps['mongerR'] ] backdrop = self.game.animations['monger_multiball_backdrop'] title = dmd.HDTextLayer(1100, 20, self.game.fonts['bebas180'], "center", line_color=(0, 0, 0), line_width=3, interior_color=(146, 24, 222)) title.set_text("IRON MONGER MULTIBALL") self.score_layer = dmd.HDTextLayer(1100, 140, self.game.fonts['bebas300'], "center", line_color=(0, 0, 0), line_width=3, interior_color=(255, 255, 255)) shoot = dmd.HDTextLayer(1100, 450, self.game.fonts['default'], "center", line_color=(0, 0, 0), line_width=3, interior_color=(255, 0, 0)) shoot.set_text("SHOOT") self.goal_text = dmd.HDTextLayer(1100, 550, self.game.fonts['default'], "center", line_color=(0, 0, 0), line_width=3, interior_color=(255, 0, 0)) self.goal_text_2 = dmd.HDTextLayer(1100, 650, self.game.fonts['default'], "center", line_color=(0, 0, 0), line_width=3, interior_color=(255, 0, 0)) self.main_display_layer = dmd.GroupedLayer( 1920, 800, [ backdrop, title, self.score_layer, shoot, self.goal_text, self.goal_text_2 ], opaque=True) self.start_movies = [ 'monger_start_1', 'monger_start_2', 'monger_start_3', 'monger_start_4' ] self.start_index = 0 self.hit_movies = [ 'monger_hit_1b', 'monger_hit_2b', 'monger_hit_3b', 'monger_hit_4b', 'monger_hit_5b', 'monger_hit_6b' ] self.monger_status = "DOWN" self.points_layer = dmd.HDTextLayer(1820, 550, self.game.fonts['bebas200'], "right", line_color=[0, 0, 0], line_width=4, interior_color=[146, 24, 222]) self.points_layer.set_text("250,000") self.super = False # text layers for intro display self.intro_1 = dmd.HDTextLayer(1890, 650, self.game.fonts['default'], "right", line_color=(0, 0, 0), line_width=6, interior_color=(224, 224, 224)) self.intro_1.set_text("MULTIBALL", blink_frames=6) self.intro_2 = dmd.HDTextLayer(1890, 550, self.game.fonts['default'], "right", line_color=(0, 0, 0), line_width=6, interior_color=(224, 224, 224)) self.intro_2.set_text("MONGER", blink_frames=6) self.intro_3 = dmd.HDTextLayer(1890, 450, self.game.fonts['default'], "right", line_color=(0, 0, 0), line_width=6, interior_color=(224, 224, 224)) self.intro_3.set_text("IRON", blink_frames=6) self.toy_valid = True script0 = [ 'immb_script0a', 'immb_script0b', 'immb_sript0c', 'immb_script0d', 'immb_script0e' ] script1 = [ 'immb_script1a', 'immb_script1b', 'immb_sript1c', 'immb_script1d', 'immb_script1e' ] script2 = [ 'immb_script2a', 'immb_script2b', 'immb_sript2c', 'immb_script2d' ] script3 = [ 'immb_script3a', 'immb_script3b', 'immb_sript3c', 'immb_script3d' ] self.scripts = [script0, script1, script2, script3] # pick out a script self.selected_script = random.choice(self.scripts) self.center_valid = False self.ball_added = False
def end_cva(self): # kill the taunt delay self.cancel_delayed("Taunt") # kill the alien delay if there is one self.cancel_delayed("Aliens") # and the display delay self.cancel_delayed("Display") # stop the GI lampshow and end the delay if any for the next one self.game.GI_lampctrl.stop_show() self.cancel_delayed("Lampshow") # stop the music #self.stop_music() # kill the drop targets self.game.bad_guys.kill_power() # do the final display # ship frame and alien frame shipBorder = dmd.FrameLayer(opaque=True, frame=self.game.assets.dmd_cvaShipsBorder.frames[0]) alienBorder = dmd.FrameLayer(opaque=True, frame=self.game.assets.dmd_cvaAliensBorder.frames[0]) # blank script script = [] # Do the saucer bit, if any saucers were destroyed if self.saucerHits > 0: # set the saucer title line if self.saucerHits == 1: textStringOne = "1 SAUCER" else: textStringOne = str(self.saucerHits) + " SAUCERS" titleLayerOne = ep.EP_TextLayer(64, 3, self.game.assets.font_7px_az, "center", opaque=False) titleLayerOne.set_text(textStringOne,color=ep.GREEN) titleTwoLayerOne = ep.EP_TextLayer(64,11, self.game.assets.font_5px_AZ,"center",opaque=False) titleTwoLayerOne.set_text("DESTROYED",color=ep.GREEN) # set the saucer score line scoreLayerOne = ep.pulse_text(self,64,18,ep.format_score(self.saucerPoints),align="center",myOpaque=True,size="9px",timing=0.1,color=ep.RED) # build the layer pageOne = dmd.GroupedLayer(128,32,[shipBorder,titleLayerOne,titleTwoLayerOne,scoreLayerOne]) # add it to the script script.append({'layer':pageOne,'seconds':1.5}) # do the aliens bit if any aliens were destroyed if self.aliensKilled > 0: # set the aliens title line if self.aliensKilled == 1: textStringTwo = "1 ALIEN" else: textStringTwo = str(self.aliensKilled) + " ALIENS" titleLayerTwo = ep.EP_TextLayer(64, 3, self.game.assets.font_7px_az, "center", opaque=False) titleLayerTwo.set_text(textStringTwo,color=ep.GREEN) titleTwoLayerTwo = ep.EP_TextLayer(64,11,self.game.assets.font_5px_AZ, "center",opaque=False) titleTwoLayerTwo.set_text("KILLED",color=ep.GREEN) # set the aliens score line scoreLayerTwo = ep.pulse_text(self,64,18,ep.format_score(self.alienPoints),align="center",myOpaque=True,size="9px",timing=0.1,color=ep.RED) # build the layer pageTwo = dmd.GroupedLayer(128,32,[alienBorder,titleLayerTwo,titleTwoLayerTwo,scoreLayerTwo]) # add it to the script script.append({'layer':pageTwo,'seconds':1.5}) # if either exist, start the script if script: # setup the script layer summary = dmd.ScriptedLayer(128,32,script) # and activate self.layer = summary myDelay = 1.5 # play a cheer noise self.game.sound.play(self.game.assets.sfx_cvaFinalRiff) self.delay(delay=0.5,handler=self.game.sound.play,param=self.game.assets.sfx_cheers) # if we hit both parts - play a second riff if self.saucerHits > 0 and self.aliensKilled > 0: self.delay(delay=1.5,handler=self.game.sound.play,param=self.game.assets.sfx_cvaFinalRiff) self.delay(delay=2,handler=self.game.sound.play,param=self.game.assets.sfx_cheers) myDelay = 3 self.delay(delay = myDelay,handler=self.finish_up) # if neither exist - go straight to finishing up else: self.finish_up()
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)
def status(self): # cancel the delay, in case we got pushed early self.cancel_delayed("Display") # hide the replay page if replays are disabled max_page = 7 # by bumping up the max page by one if replays are enabled if self.game.replays: max_page += 1 # first, tick up the page self.page += 1 # roll back around if we get over the number of pages if self.page > max_page: self.page = 1 # then show some junk based on what page we're on if self.page == 1: textLine1 = ep.EP_TextLayer(128 / 2, 1, self.game.assets.font_12px_az, "center", opaque=True).set_text("CURRENT", color=ep.YELLOW) textLine2 = ep.EP_TextLayer(128 / 2, 16, self.game.assets.font_12px_az, "center", opaque=False).set_text("STATUS", color=ep.YELLOW) textLine2.composite_op = "blacksrc" combined = dmd.GroupedLayer(128, 32, [textLine1, textLine2]) self.layer = combined # bonus information if self.page == 2: multiplier = self.game.show_tracking('bonusX') textString2 = str(multiplier) + "X MULTIPLIER" bonus = self.game.show_tracking('bonus') textString3 = "BONUS: " + ep.format_score(bonus) # default three line display self.tld("BONUS INFO:", textString2, textString3, color2=ep.ORANGE, color3=ep.ORANGE) if self.page == 3: # Multiball/Mine information locked = self.game.show_tracking('ballsLocked') if locked == 1: textString2 = str(locked) + " BALL LOCKED" else: textString2 = str(locked) + " BALLS LOCKED" shots = self.game.show_tracking('mineShotsTotal') textString3 = str(shots) + " MINE SHOTS TOTAL" # stock three line display self.tld("MINE STATUS:", textString2, textString3, color2=ep.ORANGE, color3=ep.ORANGE) # drunk multiball status if self.page == 4: # hits left to light drunk multiball left = self.game.user_settings['Gameplay (Feature)'][ 'Beer Mug Hits For Multiball'] - self.game.show_tracking( 'beerMugHits') if left <= 0: textString2 = "DRUNK MULTIBALL" textString3 = "IS LIT" else: textString2 = str(left) + " MORE HITS" textString3 = "FOR MULTIBALL" # default three line display self.tld("BEER MUG:", textString2, textString3, color2=ep.ORANGE, color3=ep.ORANGE) # circle back and clear the layer # CVA Information & Tumbleweeds if self.page == 5: left = self.game.show_tracking( 'tumbleweedShots') - self.game.show_tracking('tumbleweedHits') if left <= 0: textString2 = "COWBOYS V ALIENS" textString3 = "IS LIT" else: textString2 = str(left) + " MORE WEEDS FOR" textString3 = "COWBOYS V ALIENS" self.tld("TUMBLEWEEDS:", textString2, textString3, color2=ep.ORANGE, color3=ep.ORANGE) # combos information if self.page == 6: # combos to light badge needed = self.game.user_settings['Gameplay (Feature)'][ 'Combos for Star'] # combos so far have = self.game.show_tracking('combos') left = needed - have if left <= 0: textString2 = str(have) + " COMBOS" textString3 = "BADGE IS LIT!" else: textString2 = str(have) + " COMBOS" textString3 = str(left) + " MORE FOR BADGE" self.tld("COMBO SHOTS:", textString2, textString3, color2=ep.ORANGE, color3=ep.ORANGE) # Kills so far if self.page == 7: # quickdraws so far quickdrawKills = self.game.show_tracking('quickdrawsWon') # gunfights gunfightKills = self.game.show_tracking('gunfightsWon') textString2 = "QUICKDRAWS: " + str(quickdrawKills) textString3 = "GUNFIGHTS: " + str(gunfightKills) self.tld("GUN BATTLE WINS:", textString2, textString3, color2=ep.ORANGE, color3=ep.ORANGE) # replay score if self.page == 8: self.layer = self.replay_score_page() self.delay(name="Display", delay=3, handler=self.status)
def display_trolls(self, troll="both", mode="idle"): self.cancel_delayed("Display") if troll == "left": self.cancel_delayed("Left Display") elif troll == "right": self.cancel_delayed("Right Display") if mode == "idle": if troll == "left" or troll == "both": anim = self.game.assets.dmd_mmTrollIdleLeft self.leftTrollLayer = dmd.AnimatedLayer(frames=anim.frames, hold=False, opaque=False, repeat=True, frame_time=6) myWait = 0 if troll == "right" or troll == "both": anim = self.game.assets.dmd_mmTrollIdleRight self.rightTrollLayer = dmd.AnimatedLayer(frames=anim.frames, hold=False, opaque=False, repeat=True, frame_time=6) myWait = 0 elif mode == "hit": if troll == "left": anim = self.game.assets.dmd_mmTrollHitLeft myWait = len(anim.frames) / 10.0 self.leftTrollLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=False, repeat=False, frame_time=6) if troll == "right": anim = self.game.assets.dmd_mmTrollHitRight myWait = len(anim.frames) / 10.0 self.rightTrollLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=False, repeat=False, frame_time=6) elif mode == "dead": if troll == "left": anim = self.game.assets.dmd_mmTrollDeadLeft myWait = len(anim.frames) / 10.0 self.leftTrollLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=False, repeat=False, frame_time=6) if troll == "right": anim = self.game.assets.dmd_mmTrollDeadRight myWait = len(anim.frames) / 10.0 self.rightTrollLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=False, repeat=False, frame_time=6) else: # if we didn't get a cue to change trolls, don't mess with them myWait = 0 # build the layer self.leftTrollLayer.composite_op = "blacksrc" self.rightTrollLayer.composite_op = "blacksrc" combined = dmd.GroupedLayer(128, 32, [ self.timeLayer, self.titleLine, self.scoreLayer, self.leftTrollLayer, self.rightTrollLayer ]) self.layer = combined # set the delay for fixing it after a hit or a miss if mode == "hit": print "It's a hit - setting loop back to idle" # if a troll got hit loop back to that one to set it to idle after the animation finishes if troll == "left": self.delay("Left Display", delay=myWait, handler=self.reset_troll, param="left") if troll == "right": self.delay("Right Display", delay=myWait, handler=self.reset_troll, param="right") if mode == "dead": if self.won: # if both trolls are dead, go to the finish self.delay(delay=myWait, handler=self.finish_trolls)
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 __init__(self, game, priority, left_text, right_text, entered_handler, max_inits, extended=False): super(InitialEntryMode, self).__init__(game, priority) self.entered_handler = entered_handler self.init_font = self.game.assets.font_09Bx7 self.font = self.game.assets.font_07x5 self.letters_font = self.game.assets.font_07x5 self.layer = dmd.GroupedLayer(128, 32) self.layer.opaque = True self.layer.layers = [] self.knocks = 0 self.max_inits = max_inits self.extended = extended if type(right_text) != list: right_text = [right_text] if type(left_text) != list: left_text = [left_text, "MAX " + str(self.max_inits)] seconds_per_text = 1.5 script = [] for text in left_text: frame = dmd.Frame(width=128, height=8) self.font.draw(frame, text, 0, 0, color=ep.YELLOW) script.append({ 'seconds': seconds_per_text, 'layer': dmd.FrameLayer(frame=frame) }) topthird_left_layer = dmd.ScriptedLayer(width=128, height=8, script=script) topthird_left_layer.composite_op = 'blacksrc' self.layer.layers += [topthird_left_layer] script = [] for text in right_text: frame = dmd.Frame(width=128, height=8) self.font.draw(frame, text, 128 - (self.font.size(text)[0]), 0, color=ep.ORANGE) script.append({ 'seconds': seconds_per_text, 'layer': dmd.FrameLayer(frame=frame) }) if text == "Grand Champion": self.knocks += 2 elif text == 'High Score #1' or \ text == 'High Score #2' or \ text == 'High Score #3' or \ text == 'High Score #4': self.knocks += 1 topthird_right_layer = dmd.ScriptedLayer(width=128, height=8, script=script) topthird_right_layer.composite_op = 'blacksrc' self.layer.layers += [topthird_right_layer] self.inits_frame = dmd.Frame(width=128, height=10) inits_layer = dmd.FrameLayer(opaque=False, frame=self.inits_frame) inits_layer.set_target_position(0, 11) self.layer.layers += [inits_layer] self.lowerhalf_layer = dmd.FrameQueueLayer(opaque=False, hold=True) self.lowerhalf_layer.set_target_position(0, 24) self.layer.layers += [self.lowerhalf_layer] self.letters = [] for idx in range(26): self.letters += [chr(ord('A') + idx)] self.letters += [' ', '.'] if self.extended: self.letters += [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '(', ')', '@', '*', '&', '<', '>', '=', '^', '/', '-', '+', '!', '$', '"', "'" ] 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 intro(self,step=1,entry="inlane",onSide = 0): if step == 1: print "CVA started via " + str(entry) self.game.sound.play(self.game.assets.quote_cvaIntro) # set the running flag self.game.set_tracking("cvaStatus", "RUNNING") # and the local running flag self.running = True self.game.lamp_control.disable_bad_guys() self.game.lamp_control.disable_bonus_lanes() self.game.lamp_control.disable_badge() self.lamp_update() # trap the ball if needed if entry == "inlane": self.posts[onSide].patter(on_time=2,off_time=6,original_on_time=30) # then save the entry method and side for later self.entry = entry self.side = onSide # start the music self.stop_music() # intro section duration = self.game.sound.play(self.game.assets.music_cvaIntro) # main loop self.delay(delay=duration,handler=self.music_on,param=self.game.assets.music_cvaLoop) if self.giActive: self.delay(delay=duration,handler=self.gi_lampshow) else: self.delay(delay=duration,handler=self.game.gi_control,param="ON") #self.delay(delay=duration,handler=self.gi_bloom,param=4.35) self.delay(delay=duration,handler=self.intro,param=3) # load a blank frame to fade in from self.blankLayer = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_blank.frames[0]) self.blankLayer.composite_op = "blacksrc" # do the static display anim = self.game.assets.dmd_cvaStatic myWait = len(anim.frames) / 10.0 self.staticLayer = ep.EP_AnimatedLayer(anim) self.staticLayer.hold=False self.staticLayer.repeat = True self.staticLayer.frame_time = 6 self.staticLayer.composite_op = "blacksrc" self.layer = self.blankLayer # transition to static with a callback to a transition to the self.score_to_static() # blink/kill the GI self.gi_flutter() if step == 2: print "STEP 2" anim = self.game.assets.dmd_cvaIntro myWait = len(anim.frames) / 10.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold=True animLayer.frame_time = 6 self.layer = animLayer if step == 3: anim = self.game.assets.dmd_cvaBlastWipe myWait = len(anim.frames) / 5.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold=True animLayer.frame_time = 3 animLayer.composite_op = "blacksrc" self.desert = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_cvaDesert.frames[0]) self.desert.composite_op = "blacksrc" combined = dmd.GroupedLayer(128,32,[self.desert,animLayer]) self.layer = combined # launch 2 more balls self.game.trough.balls_to_autoplunge = 2 self.game.trough.launch_balls(2) # release the main ball if self.entry == "inlane": self.posts[self.side].disable() elif self.entry == "mine": self.game.mountain.unbusy() self.game.mountain.eject() elif self.entry == "saloon": self.game.saloon.kick() self.delay(delay=myWait,handler = self.get_going) # If the multiball ball savers are a thing, do that self.game.base.multiball_saver()
def collect_award(self): if self.shield_awards_pending > 0: self.shield_awards_pending -= 1 layers = [self.shield_bg, self.title] # if monger is running and we haven't added a ball -- do that if self.game.monger_multiball.running and \ self.game.monger_multiball.ball_added == False and \ self.game.trough.num_balls_in_play < 4: self.bot_text.set_text("ADD-A-BALL") layers.append(self.bot_text) self.game.monger_multiball.add_ball() # if whiplash is running and we haven't added a ball there -- do that elif self.game.whiplash_multiball.running and \ self.game.whiplash_multiball.ball_added == False and \ self.game.trough.num_balls_in_play < 4: self.bot_text.set_text("ADD-A-BALL") layers.append(self.bot_text) self.game.whiplash_multiball.add_ball() # if any timed mode is running, add time to any running mode elif self.game.fast_scoring.running or \ self.game.double_scoring.running or \ self.game.bogey.running: if self.game.fast_scoring.running: self.game.fast_scoring.add_time() if self.game.double_scoring.running: self.game.double_scoring.add_time() if self.game.bogey.running: self.game.bogey.add_time() self.bot_text.set_text("TIME ADDED") layers.append(self.bot_text) # otherwise it is basic award time else: choices = [2, 2, 2, 2, 2, 3, 3, 3, 3, 3] # Basic Awards 2 = 200,00, 3 = POPs Jackpot 100,000, 4 = Bonus multiplier +10x, 5 = EB, 6 = Special # Only add bonus x if they're below 20 already if self.game.base.bonus_x < 20: for n in range(0, 4, 1): choices.append(4) # Oly add extra balls if they're below max extra balls if self.game.getPlayerState( 'extra_balls_earned') < self.game.settings[ 'Machine (Standard)']['Maximum Extra Balls']: for n in range(0, 2, 1): choices.append(5) choices.append(6) # shuffle that shit up for n in range(0, 9, 1): random.shuffle(choices) print choices # then pick one selected = random.choice(choices) # and do a thing if selected == 2: self.bot_text.set_text("200,000") layers.append(self.bot_text) self.game.score(200000) elif selected == 3: self.twolineA.set_text("POPS JACKPOT GROWS") self.twolineB.set_text("100,000") self.game.pops.increase_jackpot_value(9) layers.append(self.twolineA) layers.append(self.twolineB) elif selected == 4: self.twolineA.set_text("10 X BONUS") self.twolineB.set_text("MULTIPLIER") self.increase_bonus_x(10) layers.append(self.twolineA) layers.append(self.twolineB) elif selected == 5: self.twolineA.set_text("EXTRA BALL") self.twolineB.set_text("IS LIT") self.game.base.light_extra_ball() layers.append(self.twolineA) layers.append(self.twolineB) elif selected == 6: self.twolineA.set_text("SPECIAL") self.twolineB.set_text("IS LIT") self.game.base.light_special() layers.append(self.twolineA) layers.append(self.twolineB) # set up the display print "IMG SELECTED PRIZ " + str(selected) myDisplay = dmd.GroupedLayer(1920, 1080, layers, opaque=True) # have interrupted show it print "Display built, calling interrupter jones" self.game.interrupt.display(myDisplay, 3)