Exemple #1
0
    def init(self):
        self.bgColor = (0, 0, 0)
        Ship.init()
        ship = Ship(self.width / 2, self.height / 2)
        self.shipGroup = pygame.sprite.GroupSingle(ship)

        Asteroid.init()
        self.asteroids = pygame.sprite.Group()
        for i in range(5):
            x = random.randint(0, self.width)
            y = random.randint(0, self.height)
            self.asteroids.add(Asteroid(x, y))

        self.bullets = pygame.sprite.Group()

        Explosion.init()
        self.explosions = pygame.sprite.Group()