private void clear() {
   for (int i = 0; i < level.getProjectiles().size(); i++) {
     Projectile p = level.getProjectiles().get(i);
     if (p.isRemoved()) {
       level.getProjectiles().remove(i);
     }
   }
 }
Beispiel #2
0
  protected void tickShooting() {
    cleanProjectiles();

    Player player = game.getPlayer();

    for (Projectile p : projectiles) {
      if (p.getCollisionBox().intersects(player.getCollisionBox())) {
        p.remove();
        player.damage(p.getDamage());
      }
    }
  }