Ejemplo n.º 1
0
    def make_zombie_herd(self, num_of_zombies, zombie_health, delta):
        """Creates a herd of zombies

        Creates a list of zombies generated in random positions on the screen
        start_x_pos for each zombie is a number in [-1000, 0)
        start_y_pos for each zombie is a random position along the y-axis

        Args:
            num_of_zombies: the amount of zombies to be generated in the herd
            height: the height of the display

        Returns: a sprite group of zombies
        """
        zombie_herd = pygame.sprite.Group()
        for _ in range(num_of_zombies):
            start_x = random.randint(-1050, -50)
            start_y = self.game_display.get_height() * random.uniform(0.1, 0.9)
            zombie = Zombie(start_x, start_y)
            zombie.health = zombie_health
            zombie.delta = delta
            zombie_herd.add(zombie)

        return zombie_herd