def party_started(self): # Turn the music on self.music_on("music_party") # Show the current party mode activated background = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_starsBorder.frames[0]) textLayer1 = ep.EP_TextLayer(64, 1, self.game.assets.font_7px_bold_az, "center", opaque=False).set_text("PARTY MODE START", color=ep.MAGENTA) self.ptextLayer2 = ep.EP_TextLayer(64, 12, self.game.assets.font_10px_AZ, "center", opaque=False).set_text( self.game.party_setting.upper(), color=ep.YELLOW) instructions = dmd.TextLayer( 64, 23, self.game.assets.font_5px_AZ, "center").set_text("HOLD L. FLIPPER TO CONFIRM") instructions2 = dmd.TextLayer( 64, 23, self.game.assets.font_5px_AZ, "center").set_text("HOLD R. FLIPPER TO DISABLE") script = [] script.append({'seconds': 2, 'layer': instructions}) script.append({'seconds': 2, 'layer': instructions2}) instruction_duo = dmd.ScriptedLayer(128, 32, script) instruction_duo.composite_op = "blacksrc" self.layer = dmd.GroupedLayer( 128, 32, [background, textLayer1, self.ptextLayer2, instruction_duo]) # start a bail delay self.reset_party_timeout()
def bionic_failed(self): # Lose the balls during a bionic fight and you lose # show some display line1 = dmd.TextLayer(64, 3, self.game.assets.font_15px_bionic, "center", opaque=True).set_text("FAILED") line2 = dmd.TextLayer(64, 22, self.game.assets.font_5px_AZ, "center", opaque=False).set_text("BIONIC BART ESCAPED!") combined = dmd.GroupedLayer(128, 32, [line1, line2]) self.layer = combined # play the fail quote duration = self.game.base.play_quote( self.game.assets.quote_failBionicBart) # reset all the star status self.game.badge.reset() self.delay(delay=duration, handler=self.leader_final_quote, param="fail")
def volume_display(self, volume): # cancel any previous delay self.cancel_delayed("Volume") # start a song if one isn't already playing if not self.playing and self.game.base not in self.game.modes: self.playing = True self.game.sound.play_music( self.game.assets.music_shooterLaneGroove, loops=-1) # throw some display action topLine = dmd.TextLayer(64, 3, self.game.assets.font_7px_az, "center", opaque=True) string = "VOLUME: " + str(volume) topLine.set_text(string) volumeLine = dmd.TextLayer(64, 13, self.game.assets.font_13px_score, "center", opaque=False) volumeString = "" while len(volumeString) < volume: volumeString += "A" while len(volumeString) < 10: volumeString += "B" volumeString += "C" volumeLine.set_text(volumeString) self.layer = dmd.GroupedLayer(128, 32, [topLine, volumeLine]) # set a delay to cancel self.delay("Volume", delay=2, handler=self.clear_volume_display)
def switch_warning(self, switches): script = [] switchCount = len(switches) # set up the text layer textString = "< CHECK SWITCHES >" textLayer = dmd.TextLayer(128 / 2, 24, self.game.assets.font_6px_az_inverse, "center", opaque=False).set_text(textString) textLayer.composite_op = 'blacksrc' script.append({'seconds': 1.8, 'layer': textLayer}) # then loop through the bad switches for i in range(0, switchCount, 1): name = switches[i]['switchName'] count = switches[i]['count'] textString = "< " + name + " >" textLayer = dmd.TextLayer(128 / 2, 24, self.game.assets.font_6px_az_inverse, "center", opaque=False).set_text(textString) textLayer.composite_op = 'blacksrc' script.append({'seconds': 1.8, 'layer': textLayer}) display = dmd.ScriptedLayer(128, 32, script) display.composite_op = "blacksrc" self.layer = display
def restart_hold_display(self): backdrop = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_mineEntranceBorder.frames[0]) awardTextTop = dmd.TextLayer(128 / 2, 5, self.game.assets.font_5px_bold_AZ, justify="center", opaque=False) awardTextBottom = dmd.TextLayer(128 / 2, 11, self.game.assets.font_5px_AZ, justify="center", opaque=False) timeText = dmd.TextLayer(64, 17, self.game.assets.font_9px_az, justify="center", opaque=False) timeText.composite_op = "blacksrc" awardTextTop.set_text("SHOOT THE MINE") awardTextBottom.set_text("TO RESTART MULTIBALL") textLine = "PAUSED" timeText.set_text(textLine, blink_frames=4) combined = dmd.GroupedLayer( 128, 32, [backdrop, awardTextTop, awardTextBottom, timeText]) self.layer = combined
def mine_update(self, hitStatus): # award some points ? print str(hitStatus) + " shots left to light lock" # display a "shots left to light lock type thing textLine = str(hitStatus) + " MORE TO" textLine2 = "LIGHT LOCK" backdrop = dmd.FrameLayer( opaque=True, frame=self.game.assets.dmd_mineEntranceBorder.frames[0]) textLayer = dmd.TextLayer(56, 2, self.game.assets.font_9px_az, "center", opaque=False).set_text(textLine) textLayer2 = dmd.TextLayer(56, 13, self.game.assets.font_9px_az, "center", opaque=False).set_text(textLine2) textLayer2.composite_op = "blacksrc" composite = dmd.GroupedLayer(128, 32, [backdrop, textLayer, textLayer2]) self.layer = composite # then kick the ball self.game.mountain.eject() # clear layer in 2 self.delay(name="Display", delay=2, handler=self.clear_layer)
def end_stampede(self): print "ENDING S T A M P E D E" # stop the music #self.stop_music(slice=5) # do a final display # setup a display frame backdrop = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_skullsBorder.frames[0]) textLine1 = dmd.TextLayer(128/2, 1, self.game.assets.font_7px_bold_az, "center", opaque=False) textString = "STAMPEDE TOTAL" textLine1.set_text(textString) textLine1.composite_op = "blacksrc" textLine2 = dmd.TextLayer(128/2,11, self.game.assets.font_12px_az, "center", opaque=False) totalPoints = self.game.show_tracking('Stampede Total') textLine2.set_text(ep.format_score(totalPoints)) # if the total is higher than best, set best if self.game.show_tracking('Stampede Best') < totalPoints: self.game.set_tracking('Stampede Best',totalPoints) combined = dmd.GroupedLayer(128,32,[backdrop,textLine1,textLine2]) self.layer = combined self.delay(name="Display",delay=2,handler=self.clear_layer) # set the active jackpot out of range self.active = 9 # kill the timer loop that moves the jackpot self.cancel_delayed("Timer") # set some tracking? # reset the ramp status for each in self.shots: self.game.set_tracking(each,1) # set the values for the ramp shots back down self.game.set_tracking('leftRampValue',2000) self.game.set_tracking('rightRampValue',2000) self.game.set_tracking('centerRampValue',2000) # unset the base busy flag self.game.base.busy = False self.game.base.queued -= 1 # clear the stack layer - if goldmine isn't running. This covers balls draining while the gold mine starts. Rare, but possible. if self.game.show_tracking('mineStatus') == "RUNNING": print "Goldmine is running" pass else: print "Gold mine is not running" self.game.stack_level(4,False) # turn the main music back on self.music_on(self.game.assets.music_mainTheme,mySlice=5) # remove the switch blocker self.game.switch_blocker('remove',self.myID) self.lamp_update() # Reset the stampede value self.game.set_tracking('Stampede Value', 250000) self.game.set_tracking('Stamepde Addon', 0) self.running = False # badge light - stampede is 4 self.game.badge.update(4) # unload the mode self.delay(delay=2,handler=self.unload)
def __init__(self, game, priority, font): super(ServiceModeSkeleton, self).__init__(game, priority) self.name = "" self.title_layer = dmd.TextLayer(1, 1, font, "left") self.item_layer = dmd.TextLayer(128 / 2, 12, font, "center") self.instruction_layer = dmd.TextLayer(1, 25, font, "left") self.layer = dmd.GroupedLayer( 128, 32, [self.title_layer, self.item_layer, self.instruction_layer]) self.no_exit_switch = game.machine_type == 'sternWhitestar'
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 in_progress(self): if self.running: # 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 = "TIME: " + str(int(self.modeTimer)) self.timeLine = dmd.TextLayer(128, 26, self.game.assets.font_5px_AZ, "right", opaque=False).set_text(timeString) # moving the horse if self.distance > 0: # change the x_position self.x_pos -= 2 # tick down the distance self.distance -= 1 if self.banner and self.distance == 0: print "I SHOULD DO THE BANNER MON" self.hit_banner() else: # set the horse layer position self.horse.set_target_position(self.x_pos, 0) # stick together the animation and static text with the dynamic text composite = dmd.GroupedLayer( 128, 32, [self.backdrop, self.horse, self.boat, self.timeLine]) self.layer = composite ## 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: # set up a delay to come back in 1 second with the lowered time self.delay("Mode Timer", delay=0.1, handler=self.in_progress)
def restarting(self): line1 = dmd.TextLayer(128 / 2, 3, self.game.assets.font_9px_az, "center", opaque=False).set_text("NEW") line2 = dmd.TextLayer(128 / 2, 15, self.game.assets.font_9px_az, "center", opaque=False).set_text("GAME") self.layer = dmd.GroupedLayer(128, 32, [line1, line2]) self.game.base.repeat_ding(3) self.delay(delay=2, handler=self.clear_layer)
def sw_coinDoorClosed_inactive(self, sw): line1 = dmd.TextLayer(128 / 2, 3, self.game.assets.font_7px_az, "center", opaque=True).set_text("COIN DOOR OPEN") line2 = dmd.TextLayer(128 / 2, 15, self.game.assets.font_7px_az, "center", opaque=False).set_text("HIGH VOLTAGE DISABLED") self.layer = dmd.GroupedLayer(128, 32, [line1, line2]) self.game.base.repeat_ding(3) self.delay(delay=3, handler=self.clear_layer)
def train_disabled(self): line1 = dmd.TextLayer(128 / 2, 3, self.game.assets.font_9px_az, "center", opaque=False).set_text("TRAIN DISABLED") line2 = dmd.TextLayer(128 / 2, 15, self.game.assets.font_9px_az, "center", opaque=False).set_text("CHECK ENCODER SWITCH") self.layer = dmd.GroupedLayer(128, 32, [line1, line2]) self.game.base.repeat_ding(3) self.delay(delay=2, handler=self.clear_layer)
def award_mootherlode(self, times): moo = times + 3 mooLayer = ep.EP_AnimatedLayer(self.game.assets.dmd_moother) mooLayer.frame_time = 4 mooLayer.opaque = True mooLayer.repeat = True mooLayer.hold = False scoreText = moo * self.displayMotherlodeValue self.game.score(scoreText) mooText = dmd.TextLayer(70, 12, self.game.assets.font_12px_az_outline, "center", opaque=False) mooText.composite_op = "blacksrc" mooText.set_text(str(ep.format_score(scoreText)), blink_frames=12) anim = self.game.assets.dmd_explosionWipe2 animLayer = dmd.AnimatedLayer(frames=anim.frames, hold=True, opaque=False, repeat=False, frame_time=6) animLayer.composite_op = "blacksrc" combined = dmd.GroupedLayer(128, 32, [mooLayer, mooText, animLayer]) self.game.sound.play(self.game.assets.sfx_cow3) self.layer = combined self.delay("Display", delay=3, handler=self.main_display) self.game.mountain.kick() self.bandits = False
def shift_right(self): ## routine to slide the prize display to the right # blank script and a counter script = [] count = 0 for i in range(4, 20, 4): # math out the new origin based on the step setX = 126 + i # generate the new prize layer with the shifted origin and store it in a list spot prizeList = dmd.TextLayer(setX, 1, self.game.assets.font_skillshot, "right", opaque=True).set_text( self.selectedPrizes) # combine with the lasso layer combined = dmd.GroupedLayer(128, 32, [prizeList, self.mask, self.lasso]) # stick those mothers in a script list script.append({'seconds': 0.05, 'layer': combined}) count += 1 # delay 0.2 seconds before updating to the 'new' prize list at the post shifted position self.delay(delay=0.2, handler=self.update_layer) # put the scripted shift in place! self.layer = dmd.ScriptedLayer(128, 32, script)
def generate_layer(self): prizeList = dmd.TextLayer(self.x, 1, self.game.assets.font_skillshot, "right", opaque=True).set_text(self.selectedPrizes) return dmd.GroupedLayer(128, 32, [prizeList, self.mask, self.lasso])
def pause_display(self): # set up the display p = self.game.current_player() scoreString = ep.format_score(p.score) scoreLine = ep.EP_TextLayer(34, 6, self.game.assets.font_5px_bold_AZ, "center", opaque=False).set_text(scoreString, blink_frames=8, color=ep.BROWN) timeString = "TIME: PAUSED" timeLine = ep.EP_TextLayer(34, 25, self.game.assets.font_5px_AZ, "center", opaque=False).set_text(timeString, blink_frames=10, color=ep.DARK_RED) textString2 = str((self.shotsToWin - self.shotsSoFar)) + " SHOTS FOR" awardLine1 = dmd.TextLayer(34, 11, self.game.assets.font_7px_az, "center", opaque=False).set_text(textString2) # stick together the animation and static text with the dynamic text composite = dmd.GroupedLayer(128, 32, [ self.cowLayer, self.pollyTitle, scoreLine, awardLine1, self.awardLine2, timeLine ]) self.layer = composite
def update_layer(self): """Called by the layer to update the score layer for the present game state.""" self.layer.layers = [] if len(self.game.players) <= 1: self.update_layer_1p() else: self.update_layer_4p() # Common: Add the "BALL X ... FREE PLAY" footer. common = dmd.TextLayer(128 / 2, 32 - 6, self.font_common, "center") if self.game.tournament: credit_str = 'TOURNAMENT' elif self.game.party_setting != 'Disabled': credit_str = 'PARTY MODE' else: credit_str = 'FREE PLAY' if self.credit_string_callback: credit_str = self.credit_string_callback() if self.game.ball == 0: common.set_text(credit_str) elif len(credit_str) > 0: common.set_text("BALL %d %s" % (self.game.ball, credit_str)) else: common.set_text("BALL %d" % (self.game.ball)) self.layer.layers += [common]
def weapon_loaded(self, prompt=False): # show some display line1 = dmd.TextLayer(64, 3, self.game.assets.font_15px_bionic, "center", opaque=True).set_text("LOADED") line2 = ep.EP_TextLayer(64, 22, self.game.assets.font_5px_AZ, "center", opaque=False).set_text("SHOOT BIONIC BART", color=ep.YELLOW) combined = dmd.GroupedLayer(128, 32, [line1, line2]) self.layer = combined if prompt: duration = self.game.base.play_quote( self.game.assets.quote_bionicUrge) else: duration = self.game.sound.play( self.game.assets.sfx_orchestraSpike) self.delay(name="Display", delay=1.5, handler=self.update_display) if duration < 1.5: duration = 1.5 self.delay(delay=duration, handler=self.game.restore_music)
def main_display(self): scoreLayer = dmd.TextLayer(100, 17, self.game.assets.font_marshallScore, "right", opaque=False).set_text(str(self.pointTotal)) combined = dmd.GroupedLayer(128, 32, [self.backdrop, scoreLayer]) self.layer = combined
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 = dmd.TextLayer(128 / 2, 5, self.game.assets.font_5px_bold_AZ, justify="center", opaque=False) awardTextBottom = dmd.TextLayer(128 / 2, 11, self.game.assets.font_5px_AZ, justify="center", opaque=False) timeText = dmd.TextLayer(64, 17, self.game.assets.font_9px_az, justify="center", opaque=False) timeText.composite_op = "blacksrc" awardTextTop.set_text("SHOOT THE MINE") awardTextBottom.set_text("TO RESTART MULTIBALL") if self.restartTimer == 1: textLine = "1 SECOND" else: textLine = str(self.restartTimer) + " SECONDS" timeText.set_text(textLine, blink_frames=4) 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 ball_added(self): textLine = dmd.TextLayer(64, 12, self.game.assets.font_9px_AZ_outline, "center", opaque=False).set_text("<BALL> <ADDED>", blink_frames=8) textLine.composite_op = "blacksrc" self.layer = textLine self.delay(name="Display", delay=1.5, handler=self.clear_layer)
def __init__(self, game, priority, font, name, itemlist): super(StatsDisplay, self).__init__(game, priority, font) self.name = name self.value_layer = dmd.TextLayer(128 / 2, 22, font, "center") self.items = [] #print itemlist for item in sorted(itemlist.iterkeys()): self.items.append(StatsItem(str(item), itemlist[item])) self.layer = dmd.GroupedLayer( 128, 32, [self.title_layer, self.item_layer, self.value_layer])
def main_display(self, loop=True): # cancel any display loop - if there is one self.cancel_delayed("Display") # set up the display during multiball # score line p = self.game.current_player() scoreString = ep.format_score(p.score) scoreLine = ep.EP_TextLayer(64, 4, self.game.assets.font_9px_az, "center", opaque=False).set_text(scoreString, blink_frames=4, color=ep.CYAN) scoreLine.composite_op = "blacksrc" if self.ending: textString = "ENDING LAST CALL" infoLine = dmd.TextLayer(128 / 2, 16, self.game.assets.font_5px_AZ, "center", opaque=False).set_text(textString) else: infoLine = self.infoLayer # jackpot value line jackString = "JACKPOTS = " + str(ep.format_score(self.shotValue)) if self.ending: jackString = "COLLECTING BALLS" self.jackpotLine = dmd.TextLayer(128 / 2, 22, self.game.assets.font_5px_AZ, "center", opaque=False).set_text(jackString) combined = dmd.GroupedLayer( 128, 32, [self.backdrop, scoreLine, infoLine, self.jackpotLine]) self.layer = combined # loop back in .2 to update if not loop: self.delay(name="Display", delay=0.2, handler=self.main_display)
def update_layer_1p(self): if self.game.current_player() == None: score = 0 # Small hack to make *something* show up on startup. else: score = self.game.current_player().score layer = dmd.TextLayer(128 / 2, 5, self.font_for_score_single(score), "center") layer.set_text(self.format_score(score)) self.layer.layers += [layer] ## add the burn layer self.layer.layers += [self.burnLayer1p]
def mad_cow(self, step=1): backdrop = ep.EP_AnimatedLayer(self.game.assets.dmd_cows) backdrop.hold = False backdrop.repeat = True backdrop.frame_time = 6 backdrop.opaque = True if step == 1: noises = [self.game.assets.sfx_cow1, self.game.assets.sfx_cow2] sound = random.choice(noises) self.game.sound.play(sound) textLine1 = dmd.TextLayer(64, 1, self.game.assets.font_12px_az_outline, "center", opaque=False) textLine2 = dmd.TextLayer(64, 16, self.game.assets.font_12px_az_outline, "center", opaque=False) textLine1.composite_op = "blacksrc" textLine2.composite_op = "blacksrc" textLine1.set_text("MAD", blink_frames=15) textLine2.set_text("COW", blink_frames=15) combined = dmd.GroupedLayer(128, 32, [backdrop, textLine1, textLine2]) self.layer = combined self.delay("Display", delay=1.5, handler=self.mad_cow, param=2) elif step == 2: textLine1 = dmd.TextLayer(64, 9, self.game.assets.font_12px_az_outline, "center", opaque=False) textLine1.composite_op = "blacksrc" textLine1.set_text(str(ep.format_score(50000))) combined = dmd.GroupedLayer(128, 32, [backdrop, textLine1]) self.layer = combined self.delay("Display", delay=1.5, handler=self.clear_layer) else: pass
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 __init__(self, font, font_path, text): super(DmdFontWidthsGame, self).__init__(pinproc.MachineTypeCustom) self.reset() w = 128 h = 32 self.font = font self.font_path = font_path self.text = text self.text_layer = dmd.TextLayer(0, 0, font) self.text_layer.set_text(text) mode = game.Mode(game=self, priority=9) mode.layer = dmd.GroupedLayer( w, h, [dmd.FrameLayer(frame=dmd.Frame(w, h)), self.text_layer]) self.modes.add(mode) self.dirty = False
def __init__(self, game, priority, font, name, itemlist): super(SettingsEditor, self).__init__(game, priority, font) self.title_layer = dmd.TextLayer(1, 1, font, "left") self.item_layer = dmd.TextLayer(128 / 2, 12, font, "center") self.instruction_layer = dmd.TextLayer(1, 25, font, "left") self.no_exit_switch = game.machine_type == 'sternWhitestar' #self.title_layer.set_text('Settings') self.name = name self.items = [] self.value_layer = dmd.TextLayer(128 / 2, 19, font, "center") self.layer = dmd.GroupedLayer(128, 32, [ self.title_layer, self.item_layer, self.value_layer, self.instruction_layer ]) for item in sorted(itemlist.iterkeys()): #self.items.append( EditItem(str(item), itemlist[item]['options'], itemlist[item]['value'] ) ) if 'increments' in itemlist[item]: num_options = (itemlist[item]['options'][1] - itemlist[item]['options'][0] ) / itemlist[item]['increments'] option_list = [] for i in range(0, num_options): option_list.append(itemlist[item]['options'][0] + (i * itemlist[item]['increments'])) self.items.append( EditItem(str(item), option_list, self.game.user_settings[self.name][item])) else: self.items.append( EditItem(str(item), itemlist[item]['options'], self.game.user_settings[self.name][item])) self.state = 'nav' self.stop_blinking = True self.item = self.items[0] self.value_layer.set_text(str(self.item.value)) self.option_index = self.item.options.index(self.item.value)
def high_noon_lit(self): line1 = dmd.TextLayer(64, 3, self.game.assets.font_15px_bionic, "center", opaque=True).set_text("HIGH NOON LIT") line2 = ep.EP_TextLayer(64, 22, self.game.assets.font_5px_AZ, "center", opaque=False).set_text("SHOOT THE MINE!", color=ep.ORANGE) combined = dmd.GroupedLayer(128, 32, [line1, line2]) self.layer = combined self.repeat_ding(3) self.delay(delay=1.2, handler=self.finish_up)