def _update_selection(self, delta, play_sound = True): new_selection = self._curr_selection + delta; if(new_selection < 0 or new_selection > 1): return; if(self._curr_selection == new_selection): return; if(play_sound): sound.play_eat(); self._curr_selection = new_selection; self._play_text.set_blinking (self._curr_selection == 0); self._credits_text.set_blinking(self._curr_selection == 1);
def _update_playing(self, dt): ## Input if input.is_click(pygame.locals.K_p): self._game_state = GameScene._STATE_PAUSED return ## Updates self._hud.update(dt) self._taz.update(dt) ## Taz is Dying or dead - We don't need ## update the Enemies anymore, them will be reseted ## when taz animation is done. if self._taz.get_state() != Taz.STATE_ALIVE: return taz_hit_box = self._taz.get_hit_box() ## Need to be calc'ed 1 time... for enemy in self._enemies: enemy.update(dt) ## Doesn't collided... if not enemy.check_collision(taz_hit_box): continue ## Collided if not enemy.is_fatal(): sound.play_eat() self._taz.make_eat() eat_count = self._taz.get_eat_count() self._hud.set_score(eat_count * GameScene._SCORE_MULTIPLIER) ## Ate enough enmies to accelerate them... if eat_count % GameScene._SPEED_UPDATE_COUNT == 0 and eat_count != 0: Enemy.Accelerate(GameScene._SPEED_ACCELERATION) else: sound.play_bomb() self._taz.kill()