else: self.giState = "ON" self.lamps['playfieldGI'].enable() ## score thing def score( self, points, ): """Convenience method to add *points* to the current player.""" p = self.current_player() awarded = (points * self.multiplier) p.score += awarded # check replay if they're enabled and the player hasn't earned it yet ## Replay award bit - not implemented currently - old code from CCC # if self.replays and not self.show_tracking('replay_earned'): # if p.score >= self.user_settings['Machine (Standard)']['Replay Score']: # self.set_tracking('replay_earned',True) # self.award_replay() # return tge actual awarded points return awarded ## the following just set things up such that you can run Python ExampleGame.py ## and it will create an instance of the correct game objct and start running it! if __name__ == '__main__': # change T2Game to be the class defined in this file! run_proc_game(IMGame)
under the default_modes subheading. If ball_search is "disabled" it means SkeletonGame will default to calling a method named *do_ball_search* instead of using it's built in tagging based mechanism. The following is an example of an implementation of a manual search. """ # always start by calling this: super(T2Game, self).do_ball_search(silent) # this increases self.ball_search_tries; which you may want to check to # escalate the 'level' of your search. # this strategy is fire any coil that has the same name as a switch # that's active right now. The delay is used to stagger pulses so we # don't pop a fuse (or worse) time_to_fire = 0.0 for sw in self.switches: if (sw.name in self.coils and (not sw.name.startswith('trough'))): if (sw.is_active): self.switchmonitor.delay(delay=time_to_fire, handler=self.coils[sw.name].pulse) time_to_fire += 0.5 ## the following just set things up such that you can run Python ExampleGame.py ## and it will create an instance of the correct game objct and start running it! if __name__ == '__main__': # change T2Game to be the class defined in this file! run_proc_game(T2Game)
""" If you don't want to use the full ball search mode --e.g., you can't figure out how to tag your yaml when you port this to your own game, you can use this much simpler ball_search implementation. SkeletonGame will default to calling this method if the other ball_search is disabled in your config.yaml or if your machine yaml doesn't provide enough info for ballsearch to work. """ super(Game, self).do_ball_search(silent) # this increases self.ball_search_tries; which you may want to check to # escalate the 'level' of your search. # this strategy is fire any coil that has the same name as a switch # that's active right now. The delay is used to stagger pulses so we # don't pop a fuse (or worse) time_to_fire = 0.0 for sw in self.switches: if (sw.name in self.coils and (not sw.name.startswith('trough'))): if (sw.is_active): self.switchmonitor.delay(delay=time_to_fire, handler=self.coils[sw.name].pulse) time_to_fire += 0.5 ## the following just set things up such that you can run Python ExampleGame.py # and it will create an instance of the correct game objct and start running it! if __name__ == '__main__': # change T2Game to be the class defined in this file! run_proc_game(Game)
enough info for ballsearch to work. """ super(Game, self).do_ball_search(silent) # always start by calling this # this increases self.ball_search_tries; which you may want to check to # escalate the 'level' of your search. # this might be crazy, but who cares... # this strategy is fire any coil that has the same name as a switch # that's active right now. for sw in self.switches: if sw.name in self.coils and (not sw.name.startswith("trough")): if sw.is_active: self.coils[sw.name].pulse() # if(self.switches.outhole.is_active()): # self.coils.outhole.pulse() # if(self.switches.lockTop.is_active()): # self.coils.lockTop.pulse() # if(self.switches.lockLeft.is_active()): # self.coils.lockLeft.pulse() # if(self.switches.ballPopper.is_active()): # self.coils.ballPopper.pulse() ## the following just set things up such that you can run Python ExampleGame.py # and it will create an instance of the correct game objct and start running it! if __name__ == "__main__": # change T2Game to be the class defined in this file! run_proc_game(Game)
# super(T2Game,self).start_game() # def ball_starting(self): # """ this is auto-called when the ball is actually starting # (so happens 3 or more times a game) """ # def ball_ended(self): # """ Called by end_ball(). At this point the ball is over """ # super(T2Game, self).ball_ended() # def game_ended(self): # super(T2Game, self).game_ended() def doBallSearch(self): # try to set the game up to be in a clean state from the outset: if(self.switches.outhole.is_active()): self.coils.outholeKicker_Knocker.pulse() if(self.switches.leftEyeball.is_active()): self.coils.leftEyeballEject_LeftPlayfieldFlasher.pulse() if(self.switches.rightEyeball.is_active()): self.coils.rightEyeballEject_SunFlasher.pulse() if(self.switches.singleEject.is_active()): self.coils.singleEjectHole_LeftInsertBDFlasher.pulse() ## the following just set things up such that you can run Python ExampleGame.py # and it will create an instance of the correct game objct and start running it! if __name__ == '__main__': # change T2Game to be the class defined in this file! run_proc_game(PinbotGame)
# call reset (to reset the machine/modes/etc) self.reset() # called when you want to fully reset the game def reset(self): # EVERY SkeletonGame game should start its reset() with a call to super() super(MyGame,self).reset() # initialize the mode variables; the general form is: # self.varName = fileName.classModeName(game=self) # Note this creates the mode and causes the Mode's constructor # function --aka __init__() to be run # self.some_non_advancedMode = ModeFile.MyMode(game=self) # add /some/ of the modes to the game's mode queue: # as soon as you add a mode, it is active/starts. # modes added here # e.g., # self.modes.add(self.some_non_advancedMode) # EVERY SkeletonGame game should end its reset() with a call to start_attract_mode() self.start_attract_mode() # plays the attract mode and kicks off the game ## the following just set things up such that you can run Python EmptyGame.py ## and it will create an instance of the correct game objct and start running it! if __name__ == '__main__': dname = os.path.dirname(os.path.abspath( __file__ )) os.chdir(dname) run_proc_game(MyGame)
ball_search: False under the default_modes subheading. If ball_search is "disabled" it means SkeletonGame will default to calling a method named *do_ball_search* instead of using it's built in tagging based mechanism. The following is an example of an implementation of a manual search. """ # always start by calling this: super(T2Game, self).do_ball_search(silent) # this increases self.ball_search_tries; which you may want to check to # escalate the 'level' of your search. # this strategy is fire any coil that has the same name as a switch # that's active right now. The delay is used to stagger pulses so we # don't pop a fuse (or worse) time_to_fire = 0.0 for sw in self.switches: if(sw.name in self.coils and (not sw.name.startswith('trough'))): if(sw.is_active): self.switchmonitor.delay(delay=time_to_fire, handler=self.coils[sw.name].pulse) time_to_fire+=0.5 ## the following just set things up such that you can run Python ExampleGame.py ## and it will create an instance of the correct game objct and start running it! if __name__ == '__main__': # change T2Game to be the class defined in this file! run_proc_game(T2Game)