Esempio n. 1
0
 def resolve(self, robot):
     if robot.bullet > 0 and robot.cooldown == 0:
         noise = np.random.normal(0, 3)
         robot.env.characters['bullets'].append(Objects.Bullet(robot.get_gun().center, \
             robot.angle + robot.gun_angle + noise, robot.env, robot))
         robot.bullet -= 1
         robot.cooldown = robot.max_cooldown
Esempio n. 2
0
def load_bullets(ai_settings, screen, ship, bullets):
    if len(bullets) < ai_settings.bullet_limit:
        new_bullet = Objects.Bullet(ai_settings, screen, ship)
        bullets.add(new_bullet)