示例#1
0
  public void shoot() {
    int cooldown = 1 + (int) (Math.random() * 100);
    if (cooldown <= 2) {

      Missile f = new Missile(this.x, this.y, color);
      f.setTarget(user.getX(), GamePanel.PHEIGHT);
      int size = (int) (Math.random() * 10) + 2; // min = 5 max = 105
      f.setExplosionMaxSize(size);

      synchronized (GameData.figures) {
        GameData.figures.add(f);
      }
    }
  }