def make_bullet(self): if GameState.game_time - self.player.time > self.player.speed: bullet = Ammo(WHITE, BULLET_SIZE) bullet.vector = -1 bullet.speed = 56 bullet.rect.x = self.player.rect.x + 28 bullet.rect.y = self.player.rect.y self.bullet_group.add(bullet) self.all_sprite_list.add(bullet) self.player.time = GameState.game_time GameState.shoot_bullet = False
def make_missile(self): if len(self.enemy_group): shoot = random.random() if shoot <= 0.05: shooter = random.choice([ enemy for enemy in self.enemy_group]) missile = Ammo(RED, MISSILE_SIZE) missile.vector = 1 missile.rect.x = shooter.rect.x + 15 missile.rect.y = shooter.rect.y + 40 missile.speed = 10 self.missile_group.add(missile) self.all_sprite_list.add(missile)