def wave_loading(self, param1): log.info("Starting Wave {} Loading ...".format(param1)) self.clear_all_objects() banner = Banner("Wave {} Loading ...".format(param1), GameBase.get_font_normal(), color=invaderutils.COLOR_WHITE, pos=(250,325)) GameObjectKeeper.setup(banner, 1000)
def wave_winner(self, parm1): log.info("WINNER") self.clear_all_objects() banner = Banner("Winner!", GameBase.get_font_normal(), color=invaderutils.COLOR_WHITE, pos=(250,325)) GameObjectKeeper.setup(banner, 1000) self.set_game_mode(invaderutils.GAME_END_EVENT)
def main(): log.info("Starting game ...") game = GameMachine(800, 800) game.setup() game.run() game.teardown() log.info("... Game Done!")
def wave_4(self, param): log.info("Starting Wave 4") self._wave_basics() # Setup bad guys for x in range( 0, 720, 75): enemy = enemy_smiling_vader(x,70,movex=-3) GameObjectKeeper.setupenemy(enemy, 50) self.set_game_mode(invaderutils.MODE_FIGHT_4_EVENT)
def wave_5(self, param): log.info("Starting Wave 5") self._wave_basics() # Setup bad guys for x in range( 0, 400, 100): enemy = enemy_the_frig(x,70,movex=1) GameObjectKeeper.setupenemy(enemy, 50) enemy = enemy_the_frig(x + 300, 140, movex=-1) GameObjectKeeper.setupenemy(enemy, 50) for x in range( 0, 720, 75): enemy = enemy_smiling_vader(x,70,movex=-3) GameObjectKeeper.setupenemy(enemy, 50) for x in range( 0, 750, 75): enemy = enemy_fonzy(x, 70, movex=-2) GameObjectKeeper.setupenemy(enemy, 50) enemy = enemy_fonzy(x, 120, movex=-2) GameObjectKeeper.setupenemy(enemy, 50) for x in range( 0, 400, 150): enemy = enemy_little_john(x, 50) GameObjectKeeper.setupenemy(enemy, 50) enemy = enemy_little_john(x+125, 150) GameObjectKeeper.setupenemy(enemy, 50) enemy = enemy_little_john(x, 250) GameObjectKeeper.setupenemy(enemy, 50) enemy = enemy_little_john(x+125, 350) GameObjectKeeper.setupenemy(enemy, 50) # enemy = Enemy(x, 25, invaderutils.invader_png(4), bombclockpts=(100,250), lowermove=30, movex=-3) # GameObjectKeeper.setupenemy(enemy, 50) # enemy = Enemy(x-55, 100, invaderutils.invader_png(2), bombclockpts=(1500,3000), lowermove=40) # GameObjectKeeper.setupenemy(enemy, 50) # enemy = Enemy(x, 175, invaderutils.invader_png(1), bombclockpts=(1000,2000), lowermove=60,movex=-2) # GameObjectKeeper.setupenemy(enemy, 50) # enemy = Enemy(x+25, 275, invaderutils.invader_png(3), bombclockpts=(1000,4000), lowermove=80) # GameObjectKeeper.setupenemy(enemy, 50) self.set_game_mode(invaderutils.MODE_FIGHT_5_EVENT)
def wave_2(self, param): log.info("Starting Wave 2") self._wave_basics() # Setup bad guys for x in range( 0, 750, 75): enemy = enemy_fonzy(x, 70, movex=-2) GameObjectKeeper.setupenemy(enemy, 50) enemy = enemy_fonzy(x, 120, movex=-2) GameObjectKeeper.setupenemy(enemy, 50) self.set_game_mode(invaderutils.MODE_FIGHT_2_EVENT)
def wave_3(self, param): log.info("Starting Wave 3") self._wave_basics() # Setup bad guys for x in range( 0, 400, 100): enemy = enemy_the_frig(x,70,movex=1) GameObjectKeeper.setupenemy(enemy, 50) enemy = enemy_the_frig(x + 300, 140, movex=-1) GameObjectKeeper.setupenemy(enemy, 50) self.set_game_mode(invaderutils.MODE_FIGHT_3_EVENT)
def _check(self, state, next_state, time_tics): for t in self.transitions: if ((t.state == state) or (t.state is None)) and (t.next_state == next_state): if (t.delay == 0): self.current_state = next_state log.info("TRANSITION: {} => {}".format(state, next_state)) return (t.wave_setup, t.param) elif (t.start_time == None): t.start_time = datetime.now() elif (t.start_time + timedelta(seconds=t.delay) < datetime.now()): self.current_state = next_state log.info("TRANSITION: {} => {}".format(state, next_state)) return (t.wave_setup, t.param) return None
def wave_1(self, param): log.info("Starting Wave 1") self._wave_basics() # Setup bad guys for x in range( 0, 400, 150): enemy = enemy_little_john(x, 50) GameObjectKeeper.setupenemy(enemy, 50) enemy = enemy_little_john(x+125, 150) GameObjectKeeper.setupenemy(enemy, 50) enemy = enemy_little_john(x, 250) GameObjectKeeper.setupenemy(enemy, 50) enemy = enemy_little_john(x+125, 350) GameObjectKeeper.setupenemy(enemy, 50) self.set_game_mode(invaderutils.MODE_FIGHT_1_EVENT)
def wave_fight(self, param1): log.info("Fight !")
def process_events(self, evt): if evt.type == invaderutils.GAME_END_EVENT: log.info("Bye!") self.set_game_mode(invaderutils.GAME_END_EVENT)
def sortobjects(cls) -> None: log.info("Sorting Game Stage ...") cls.OBJECT_LIST.sort( key=lambda ob: ob.level)