def generate_enemies(self): """ Generate the next enemy or enemies :return: enemy """ if sum(self.__current_wave) == 0: if len(self.enemies) == 0: if self.wave == 10 and self.__money > 2000 and self.__enemy_kill > 100: self.__current_wave = bonus_wave elif (self.wave + 1) % 5 == 0 and self.__lives == 10: self.__current_wave = challenge_waves[self.wave // 5] else: self.wave += 1 self.__current_wave = waves[self.wave] self.pause = True self.play_pause_button.pause = self.pause else: wave_enemies = [ Scorpion(Game.path, self.game_map), Wizard(Game.path, self.game_map), Club(Game.path, self.game_map), Troll(Game.path, self.game_map), Sword(Game.path, self.game_map), Goblin(Game.path, self.game_map) ] for x in range(len(self.__current_wave)): if self.__current_wave[x] != 0: self.enemies.append(wave_enemies[x]) self.__current_wave[x] = self.__current_wave[x] - 1 break
def __init__(self): self.width = 1200 self.height = 700 self.win = pygame.display.set_mode((self.width, self.height)) self.enemies = [Scorpion(), Club(), Wizard()] self.towers = [] self.lives = 10 self.money = 100 self.bg = pygame.image.load( os.path.join("game_assets", "td-tilesets1-2", "tower-defense-game-tilesets", "PNG", "game_background_2", "game_background_2.png")) self.bg = pygame.transform.scale(self.bg, (self.width, self.height))
def gen_enemies(self): """ generate the next enemy or enemies to show :return: enemy """ if sum(self.current_wave) == 0: if len(self.enemys) == 0: self.wave += 1 self.current_wave = waves[self.wave] self.pause = True self.playPauseButton.paused = self.pause else: wave_enemies = [Scorpion(), Wizard(), Club(), Sword()] for x in range(len(self.current_wave)): if self.current_wave[x] != 0: self.enemys.append(wave_enemies[x]) self.current_wave[x] = self.current_wave[x] - 1 break