def light_extra_ball(self,callback=None): # add the ball to the pending extra balls derp = self.game.increase_tracking('extraBallsPending') print "EXTRA BALLS PENDING: " + str(derp) # audit tick self.game.game_data['Audits']['Extra Balls Earned'] += 1 # open the mine if self.game.mountain.mineTicks != 8: self.game.mountain.full_open() # setup a bunch of text textLine1 = ep.EP_TextLayer(28, 4, self.game.assets.font_9px_az, "center", opaque=False).set_text("EXTRA",color=ep.ORANGE) textLine2 = ep.EP_TextLayer(28, 16, self.game.assets.font_9px_az, "center", opaque=False).set_text("BALL",color=ep.ORANGE) textLine3 = ep.pulse_text(self,96,4,"IS",color=ep.GREEN) textLine4 = ep.pulse_text(self,96,16,"LIT",sequence=[1,3],color=ep.GREEN) # and a backdrop backdrop = dmd.FrameLayer(opaque=True, frame=self.game.assets.dmd_ball.frames[0]) # and the wipe animation anim = self.game.assets.dmd_horseWipeRight myWait = len(anim.frames) / 10.0 + 1 animLayer = dmd.AnimatedLayer(frames=anim.frames,hold=True,opaque=False,repeat=False,frame_time=6) animLayer.composite_op = "blacksrc" # slap it all together composite = dmd.GroupedLayer(128,32,[backdrop,textLine1,textLine2,textLine3,textLine4,animLayer]) # and turn it on self.layer = composite # with a sound effect self.game.sound.play(self.game.assets.sfx_leftLoopEnter) # play a quote self.play_ordered_quote(self.game.assets.quote_extraBallLit,'lit_extra_ball') self.lamp_update() # callback process for calling from skill shot if callback: self.delay(delay=myWait,handler=callback) self.delay("Display",delay=myWait,handler=self.clear_layer) print "EXTRA BALL LIT"
def light_gunfight(self,callback=None): print "GUNFIGHT IS LIT" # turn on the lights # show the display backdrop = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_singleCowboyBorder.frames[0]) textString1 = "GUNFIGHT" textLayer1 = ep.pulse_text(self,77,2,textString1,size="12px") textString2 = "IS LIT" textLayer2 = ep.pulse_text(self,77,15,textString2,size="12px",color=ep.GREEN) self.layer = dmd.GroupedLayer(128,32,[backdrop,textLayer1,textLayer2]) # play a quote self.game.sound.play(self.game.assets.sfx_flourish6) self.play_ordered_quote(self.game.assets.quote_gunfightLit,'gunfight',priority=True) # set the tracking self.game.set_tracking('gunfightStatus',"READY") self.lamp_update() self.game.coils.leftGunFlasher.schedule(0x11111111,cycle_seconds=1) self.game.coils.rightGunFlasher.schedule(0x11111111,cycle_seconds=1) if callback != None: print "I GOT A GUNFIGHT CALLBACK" self.delay("Callback",delay=2,handler=callback) self.delay(delay=2,handler=self.clear_layer) if self.busy: print "Light Gunfight - Delay timer for unbusy" self.delay(delay=2,handler=self.unbusy)
def light_bounty(self,callback=None): # set the tracking self.game.set_tracking('isBountyLit', True) # show something on the screen backdrop = dmd.FrameLayer(opaque=False, frame=self.game.assets.dmd_starsBorder.frames[0]) topText = ep.pulse_text(self,64,4,"COLLECT BOUNTY") bottomText = ep.pulse_text(self,64,16,"IS LIT",color=ep.GREEN) self.repeat_ding(4) self.layer = dmd.GroupedLayer(128,32,[backdrop,topText,bottomText]) # play a voice clip about the bounty being ready self.play_ordered_quote(self.game.assets.quote_bountyLit,'lit_bounty') # lights and whatnot self.lamp_update() self.delay("Display",delay=1.6,handler=self.clear_layer) # if we got a callback - do that - its for skillshot ending if callback: self.delay(delay=1.6,handler=callback)
def light_drunk_multiball(self,callback = None): # set the hits to the same number it takes to light - this is a catch for the super skillshot award self.game.set_tracking('beerMugHits',self.mug_shots) # enable the multiball self.game.set_tracking('drunkMultiballStatus', "READY") self.lamp_update() textLine1 = ep.pulse_text(self,51,1,"DRUNK",color=ep.ORANGE) textLine2 = ep.pulse_text(self,51,12,"MULTIBALL",color=ep.ORANGE) textLine3 = ep.EP_TextLayer(51, 23, self.game.assets.font_5px_AZ, "center", opaque=False).set_text("IS LIT",color=ep.GREEN) self.repeat_ding(4) duration = self.game.base.play_quote(self.game.assets.quote_drunkMultiballLit) self.delay(delay=duration,handler=self.game.base.play_quote,param=self.game.assets.quote_shootSaloon) self.mug_display(textLine1,textLine2,textLine3) # so super can start gameplay if callback: self.delay(delay=1.7,handler=callback) self.delay(delay=1.7,handler=self.clear_layer)
def light_bounty(self, callback=None): # set the tracking self.game.set_tracking('isBountyLit', True) # show something on the screen backdrop = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_starsBorder.frames[0]) topText = ep.pulse_text(self, 64, 4, "COLLECT BOUNTY") bottomText = ep.pulse_text(self, 64, 16, "IS LIT", color=ep.GREEN) self.repeat_ding(4) self.layer = dmd.GroupedLayer(128, 32, [backdrop, topText, bottomText]) # play a voice clip about the bounty being ready self.play_ordered_quote(self.game.assets.quote_bountyLit, 'lit_bounty') # lights and whatnot self.lamp_update() self.delay("Display", delay=1.6, handler=self.clear_layer) # if we got a callback - do that - its for skillshot ending if callback: self.delay(delay=1.6, handler=callback)
def light_gunfight(self, callback=None): print "GUNFIGHT IS LIT" # turn on the lights # show the display backdrop = dmd.FrameLayer( opaque=False, frame=self.game.assets.dmd_singleCowboyBorder.frames[0]) textString1 = "GUNFIGHT" textLayer1 = ep.pulse_text(self, 77, 2, textString1, size="12px") textString2 = "IS LIT" textLayer2 = ep.pulse_text(self, 77, 15, textString2, size="12px", color=ep.GREEN) self.layer = dmd.GroupedLayer(128, 32, [backdrop, textLayer1, textLayer2]) # play a quote self.game.sound.play(self.game.assets.sfx_flourish6) self.play_ordered_quote(self.game.assets.quote_gunfightLit, 'gunfight', priority=True) # set the tracking self.game.set_tracking('gunfightStatus', "READY") self.lamp_update() self.game.coils.leftGunFlasher.schedule(0x11111111, cycle_seconds=1) self.game.coils.rightGunFlasher.schedule(0x11111111, cycle_seconds=1) if callback != None: print "I GOT A GUNFIGHT CALLBACK" self.delay("Callback", delay=2, handler=callback) self.delay(delay=2, handler=self.clear_layer) if self.busy: print "Light Gunfight - Delay timer for unbusy" self.delay(delay=2, handler=self.unbusy)
def display_win(self,rankTitle): textString3 = "YOUR RANK: " + rankTitle newrank = self.game.show_tracking('rank') values = [str(ep.format_score(500000)),str(ep.format_score(750000)),str(ep.format_score(1000000)),str(ep.format_score(1500000)),str(ep.format_score(2000000))] textString4 = "QUICKDRAWS WORTH: " + values[newrank] # award some points points = 750000 self.game.score(points) self.game.add_bonus(100000) # show the win screen textLine1 = ep.EP_TextLayer(64, 0, self.game.assets.font_7px_bold_az, "center", opaque=True).set_text("BAD GUY SHOT!",color=ep.YELLOW) textLine2 = ep.pulse_text(self,64,9,ep.format_score(points),color=ep.GREEN) textLine3 = ep.EP_TextLayer(64, 20, self.game.assets.font_5px_AZ, "center", opaque=False).set_text(textString3,color=ep.BROWN) textLine4 = ep.EP_TextLayer(64, 26, self.game.assets.font_5px_AZ, "center", opaque=False).set_text(textString4,color=ep.BROWN) self.layer = dmd.GroupedLayer(128,32,[textLine1,textLine2,textLine3,textLine4]) self.delay("Operational",delay=2,handler=self.end_gunfight)
def hit_alien(self,target): if target in self.activeAliens: # audit self.game.game_data['Feature']['CVA Aliens Hit'] += 1 # flasher flourish self.game.base.red_flasher_flourish() # cancel the display self.cancel_delayed("Display") # remove the dead alien #print "REMOVE ALIEN - " + str(target) self.activeAliens.remove(target) # count the kill self.aliensKilled += 1 # and count it for the round self.aliensKilledRound += 1 # do the display of the dying anim = self.game.assets.dmd_cvaShot myWait = len(anim.frames) / 10.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold=True animLayer.frame_time = 6 animLayer.composite_op = "blacksrc" myString = self.point_value("ALIEN") self.game.score(myString) # add the points to the running total self.alienPoints += myString titleLayer = ep.EP_TextLayer(64, 4, self.game.assets.font_7px_az, "center", opaque=False).set_text("ALIEN KILLED",color=ep.GREEN) scoreLayer = ep.pulse_text(self,64,14,ep.format_score(myString),align="center",myOpaque=True,size="12px",timing=0.1,color=ep.RED) combined = dmd.GroupedLayer(128,32,[scoreLayer,titleLayer,animLayer]) self.layer = combined self.delay(delay=0.5,handler=self.game.sound.play,param=self.game.assets.sfx_cvaGroan) self.game.sound.play(self.game.assets.sfx_cvaAlienHit) # delay the normal display and next saucer theDelay = myWait + 1.5 # if all 4 are dead, we change modes to the ship if self.aliensKilledRound == 4: self.delay(delay=theDelay,handler=self.switch_modes,param="SHIP") elif self.aliensKilledRound == 2: #print "WAVE 2 NOW" self.delay("Aliens",delay=theDelay,handler=self.teleport_aliens,param=2) else: self.delay("Display",delay=theDelay,handler=self.update_display)
def hit_alien(self,target): if target in self.activeAliens: # audit self.game.game_data['Feature']['CVA Aliens Hit'] += 1 # flasher flourish self.game.base.red_flasher_flourish() # cancel the display self.cancel_delayed("Display") # remove the dead alien print "REMOVE ALIEN - " + str(target) self.activeAliens.remove(target) # count the kill self.aliensKilled += 1 # and count it for the round self.aliensKilledRound += 1 # do the display of the dying anim = self.game.assets.dmd_cvaShot myWait = len(anim.frames) / 10.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold=True animLayer.frame_time = 6 animLayer.composite_op = "blacksrc" myString = self.point_value("ALIEN") self.game.score(myString) # add the points to the running total self.alienPoints += myString titleLayer = ep.EP_TextLayer(64, 4, self.game.assets.font_7px_az, "center", opaque=False).set_text("ALIEN KILLED",color=ep.GREEN) scoreLayer = ep.pulse_text(self,64,14,ep.format_score(myString),align="center",myOpaque=True,size="12px",timing=0.1,color=ep.RED) combined = dmd.GroupedLayer(128,32,[scoreLayer,titleLayer,animLayer]) self.layer = combined self.delay(delay=0.5,handler=self.game.sound.play,param=self.game.assets.sfx_cvaGroan) self.game.sound.play(self.game.assets.sfx_cvaAlienHit) # delay the normal display and next saucer theDelay = myWait + 1.5 # if all 4 are dead, we change modes to the ship if self.aliensKilledRound == 4: self.delay(delay=theDelay,handler=self.switch_modes,param="SHIP") elif self.aliensKilledRound == 2: print "WAVE 2 NOW" self.delay("Aliens",delay=theDelay,handler=self.teleport_aliens,param=2) else: self.delay("Display",delay=theDelay,handler=self.update_display)
def saucer_hit_display(self): # audit self.game.game_data['Feature']['CVA Ships Hit'] += 1 # lampshow self.game.lampctrl.play_show(self.game.assets.lamp_sparkle, repeat=False,callback=self.lamp_update) anim = self.game.assets.dmd_cvaLargeShipExplodes myWait = len(anim.frames) / 10.0 animLayer = ep.EP_AnimatedLayer(anim) animLayer.hold=True animLayer.frame_time = 6 animLayer.composite_op = "blacksrc" myString = self.point_value("SAUCER") # add the points to the running total self.saucerPoints += myString titleLayer = ep.EP_TextLayer(64, 4, self.game.assets.font_7px_az, "center", opaque=False).set_text("SAUCER DESTROYED",color=ep.GREEN) scoreLayer = ep.pulse_text(self,64,14,ep.format_score(myString),align="center",myOpaque=True,size="12px",timing=0.1,color=ep.RED) combined = dmd.GroupedLayer(128,32,[scoreLayer,titleLayer,animLayer]) self.layer = combined # play the boom self.game.sound.play(self.game.assets.sfx_cvaExplosion) # delay the normal display and next saucer theDelay = myWait + 1.5 self.delay(delay=theDelay+0.1,handler=self.update_display) self.delay(delay=theDelay,handler=self.next_saucer,param=True)
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()