Esempio n. 1
0
  /**
   * Decreases the count down value of status duration, bar width and displays the percentate of
   * status duration left If there is a target, When status duration reaches zero, the status
   * disappears.
   *
   * @param change The Change in status duration value each Act
   */
  public void update(int change) {

    if (currCountDown > 0) {
      currCountDown -= change; // decreases the current countdown by the change value
      percentCountdown =
          (double) currCountDown
              / maxCountDown; // set a double value of percent countdown by dividing current
                              // countdown by maximum countdown
      currBarWidth =
          (int)
              (percentCountdown
                  * barWidth); // set a interger value of current bar width by multiplying percent
                               // countdown and bar width and casting them into a interger value
      percentDisplay =
          (int)
              (percentCountdown
                  * 100); // set a interget value of percentDisplay by multiplying percentCountdown
                          // by 100.
      percentCounter =
          Integer.toString(
              percentDisplay); // cast the interger percentDisplay into a string and store it in
                               // percentCouner
      myImage.clear(); // clears the image
      myImage.drawString(percentCounter + "%", 70, 30); // draws the percentCounter on myImage
      if (currBarWidth > 1) bar.scale(currBarWidth, BAR_HEIGHT); // rescale the bar size
      if (selection == true) if (currCountDown == 1) currCountDown += 1;
      update(); // redraw the image
    }
    if (selection == false)
      if (currCountDown == 0) // if current countdown is 0
      removeStatus(); // remove status
  }
Esempio n. 2
0
 /** constructor de variables de la clase pizza */
 public Pizza() {
   dir = 1;
   vel = 3;
   GreenfootImage image = getImage();
   image.scale(30, 30);
   setImage(image);
 }
Esempio n. 3
0
  private void ammoChange(AmmoData ad) {

    ammoICO.setImage(ad.image);
    GreenfootImage i = ammoICO.getImage();
    i.scale((int) (ad.width * 1.75), (int) (ad.height * 1.75));
    playerAmmo = ad;
    ammoUI.setPoints(ammo[playerAmmunition.indexOf(ad)]);
  }
Esempio n. 4
0
  public Shield() {
    super();

    GreenfootImage image = getImage();
    image.scale(50, 50);
    setImage(image);

    effectiveTimeLeft = 500;
  }
  /** Update the image on screen to show the current value. */
  private void updateImage() {
    GreenfootImage image = new GreenfootImage(background);
    GreenfootImage text =
        new GreenfootImage(prefix + "Points: " + value, 22, Color.MAGENTA, transparent);

    if (text.getWidth() > image.getWidth() - 20) {
      image.scale(text.getWidth() + 20, image.getHeight());
    }

    image.drawImage(
        text, (image.getWidth() - text.getWidth()) / 2, (image.getHeight() - text.getHeight()) / 2);
    setImage(image);
  }
Esempio n. 6
0
 private void drawBox() {
   amarelo = new Color(255, 188, 0);
   laranja = new Color(255, 133, 0);
   imgHelp = getImage();
   imgHelp.setColor(laranja);
   imgHelp.fill();
   imgHelp.scale(200, 50);
   imgHelp.setColor(amarelo);
   int margem = 5;
   int largura = imgHelp.getWidth() - 2 * margem;
   int altura = imgHelp.getHeight() - 2 * margem;
   imgHelp.fillRect(margem, margem, largura, altura);
 }
Esempio n. 7
0
 // Method runs to update number of mana potions on screen.
 private void updateImageTwo() {
   GreenfootImage imageTwo =
       new GreenfootImage(fullMana * heightTwo + 64, heightTwo); // create the image's object
   imageTwo.drawRect(
       0, 0, imageTwo.getWidth() - 1, imageTwo.getHeight() - 1); // frame added to the object
   GreenfootImage potions = new GreenfootImage("mana_Ahrenn.png"); // obtains image of potion
   potions.scale(4 * heightTwo / 6, 4 * heightTwo / 6); // resizes image of potion
   for (int i = 0; i < mana; i++) {
     imageTwo.drawImage(
         potions,
         4 * +4 + i * 9 * 4,
         4); // adds a specific number of potions to image based on amount of mana remaining
   }
   setImage(imageTwo); // Actually makes the image look like how the values above desire it to be.
 }
Esempio n. 8
0
 // Method runs to update number of hearts on screen.
 private void updateImage() {
   int heightOne = (int) height; // value of height for hearts recasted
   GreenfootImage image =
       new GreenfootImage(fullLives * heightOne + 64, heightOne); // create the image's object
   image.drawRect(0, 0, image.getWidth() - 1, image.getHeight() - 1); // frame added to the object
   GreenfootImage hearts = new GreenfootImage("hearts_Ahrenn.png"); // obtains image of heart
   hearts.scale(4 * heightOne / 6, 4 * heightOne / 6); // resizes image of heart
   for (int i = 0; i < lives; i++) {
     image.drawImage(
         hearts,
         4 * +4 + i * 9 * 4,
         4); // adds a specific number of hearts to image based on number of lives remaining
   }
   setImage(image); // Actually makes the image look like how the values above desire it to be.
 }
 public AmericanFootball() {
   GreenfootImage image = getImage();
   image.scale(75, 75);
   setImage(image);
 }
Esempio n. 10
0
 public Bullet(int angle, double speed, int life) {
   super(0.1, life, new Vector(angle, speed));
   this.image = new GreenfootImage("images/beeper.png");
   image.scale(15, 15);
   this.setImage(image);
 }
 public Turret2() {
   GreenfootImage img = getImage();
   img.scale(16, 16);
   setImage(img);
 }
Esempio n. 12
0
 public Penny() {
   GreenfootImage image = getImage();
   image.scale(50, 50);
 }