public static void shootBlueWeapon(GameObject shooter, float yTarget) {
    Blue blueShoot;

    if (shooter instanceof CampaignShip) {
      if (isCampaignShipReadyToShoot(TypeShoot.BLUE)) {

        int x = (int) (shooter.getX() + shooter.getWidth());
        int y = (int) (shooter.getY() + shooter.getHeight() / 3);

        blueShoot = new Blue(shooter, x, y, yTarget);

        addToShoots(blueShoot, x, y);
      }
    } else {

      int x = (int) (shooter.getX());
      int y = (int) (shooter.getY() + shooter.getHeight() / 2);

      blueShoot =
          new Blue(
              shooter, x, y, CampaignScreen.ship.getY() + (CampaignScreen.ship.getHeight() / 2));

      x = (int) blueShoot.getX() - (int) blueShoot.getWidth();

      addToShoots(blueShoot, x, y);
    }
  }
Example #2
0
  public static void main(String[] args) {
    Dice dice1 = new Dice();
    Dice dice2 = new Dice();
    Blue blue = new Blue(dice1, dice2);

    System.out.println(blue.toString());
  }
  public Object clone() throws CloneNotSupportedException {
    BeerConsumer consumer = (BeerConsumer) super.clone();
    consumer.setAlpineBeersToConsume(new Vector());
    Iterator<Alpine> alpineIterator = this.getAlpineBeersToConsume().iterator();
    while (alpineIterator.hasNext()) {
      Alpine alpine = alpineIterator.next();
      consumer.addAlpineBeerToConsume(alpine.clone());
    }

    consumer.setBlueLightBeersToConsume(new Vector());
    Iterator<BlueLight> blueLightIterator = this.getBlueLightBeersToConsume().iterator();
    while (blueLightIterator.hasNext()) {
      Blue blue = blueLightIterator.next();
      consumer.addBlueLightBeerToConsume((BlueLight) blue.clone());
    }
    return consumer;
  }
 public void addBlueBeerToConsume(Blue blue) {
   blue.setBeerConsumer(this);
   blueBeersToConsume.put(blue.getUniqueKey(), blue);
 }