Esempio n. 1
0
    def update(self, dt):
        super().update(dt)

        self.direc = self.angle_to(self.player)

        if self.pos.distance_to(self.player.rect.center) < 300:
            self.vel = vectool.from_angle(self.direc +
                                          (self.orbit * 90)) * self.speed
        else:
            self.vel = vectool.from_angle(self.direc +
                                          (self.orbit * 45)) * self.speed

        self.pos += self.vel

        self.rotate_img()

        if self.checkShoot():
            self.shoot()
Esempio n. 2
0
    def __init__(self, game, pos, direc=0, speed=7):
        pygame.sprite.Sprite.__init__(self, game.all_sprites,
                                      game.bullet_sprites)
        self.game = game

        self.pos = Vector2(pos)
        self.direc = direc
        self.speed = speed

        self.rotate_img()

        self.vel = vectool.from_angle(self.direc) * self.speed
Esempio n. 3
0
    def __init__(self, game, center, img):
        pygame.sprite.Sprite.__init__(self, game.all_sprites,
                                      game.collect_sprites)
        self.game = game

        self.pos = Vector2(center)

        self.direc = randint(0, 359)
        self.vel = vectool.from_angle(self.direc) * randint(2, 5)

        self.image = img
        self.image = pygame.transform.rotate(self.image, self.direc)

        self.rect = self.image.get_rect()
        self.rect.center = self.pos
Esempio n. 4
0
    def __init__(self, game):
        super().__init__(game)

        self.pos = self.spawnPos()
        self.direc = 0

        self.img = self.game.img["tankbase-red.png"]
        self.rotate_img()

        self.speed = 1
        self.vel = vectool.from_angle(self.direc) * self.speed

        self.health = 5

        self.turret = EnemyTurret(self.game, self)
        self.shoot_speed = 0.5

        self.size = 8
Esempio n. 5
0
    def __init__(self, game):
        super().__init__(game)

        self.pos = self.spawnPos()
        self.direc = self.angle_to(self.player)

        self.img = self.game.img["red_01.png"]
        self.rotate_img()

        self.speed = 2
        self.orbit = 1 if random() < 0.5 else -1
        self.vel = vectool.from_angle(self.direc +
                                      (self.orbit * 90)) * self.speed

        self.health = 2
        self.shoot_speed = 0.25

        self.size = 4
Esempio n. 6
0
 def update(self, dt=None):
     self.direc = vectool.angle_to(self, self.target)
     self.rotate_img()
     self.turret_end = self.rect.center + (vectool.from_angle(self.direc) *
                                           26)
Esempio n. 7
0
 def direc_vec(self):
     return vectool.from_angle(self.direc)