Exemplo n.º 1
0
 // -------------------------------------------------------------------------------------------------------------------------------------------------------
 public String getPowerUp() {
   if (!player1.getPower().equals("")) {
     return ("P1");
   } else {
     return "none";
   }
 }
Exemplo n.º 2
0
 public void keyReleased(KeyEvent evt) {
   keys[evt.getKeyCode()] = false;
   // reset the counters for for the sprite s
   player1.resetCounter();
   if (!player1.getPower().equals("Balloon")) {
     player1.resetPicCounter();
   }
 }
Exemplo n.º 3
0
  public void checkPupCollision() {
    // pretty much the same thing as before, however it alsoe does the powerup effects
    for (Powerup p : pupList) {
      if (p.getOnScreen()) { // can be removed later on
        if (p.checkCollision(player1)) {
          pupRemove.add(p);
          player1.setPower(p.getType());
          player1.setVelo(50);
        }
      } else {
        pupRemove.add(p);
      }
    }
    if (player1.getPower().equals("Lucky")) { // changes everything to stars
      for (Coin c : coinList) {
        starList.add(new Star(c.getX(), c.getY(), 2));
        cRemove.add(c);
      }
      for (Box b : boxList) {
        starList.add(new Star(b.getX(), b.getY(), 2));
        bRemove.add(b);
      }
      for (Enemy e : enemyList) {
        starList.add(new Star(e.getX(), e.getY(), 2));
        eRemove.add(e);
      }
    } else if (player1.getPower().equals("Magnet")) { // moves the coins towards the player
      for (Coin c : coinList) {
        c.moveTowards(player1);
      }
    } else { // else do nothing

    }
    for (Powerup p : pupRemove) {
      poofList.add(new Poof(p.getX(), p.getY(), 2));
      pupList.remove(p);
    }
    pupRemove = new ArrayList<Powerup>();
  }
Exemplo n.º 4
0
 public void drawPowerUpEffect(Graphics g) {
   if (player1.getPower().equals("Magnet")) {
     Image magpic = magnetList.get((int) count % 6);
     g.drawImage(
         magpic,
         player1.getX() - ((magpic.getWidth(null) - player1.getWidth()) / 2),
         player1.getY() - ((magpic.getHeight(null) - player1.getHeight()) / 2),
         magpic.getWidth(null),
         magpic.getHeight(null),
         this);
     count += 0.1;
   } else if (player1.getPower().equals("Ball")) {
     g.drawImage(
         ballPower,
         player1.getX() - ballPower.getWidth(null) / 2 + 17,
         player1.getY() + player1.getHeight() - 20,
         ballPower.getWidth(null),
         ballPower.getHeight(null),
         this);
   } else if (player1.getPower().equals("Sheild")) {
     g.drawImage(
         sheildPower,
         player1.getX() - ((sheildPower.getWidth(null) - player1.getWidth()) / 2),
         player1.getY() - ((sheildPower.getHeight(null) - player1.getHeight()) / 2),
         sheildPower.getWidth(null),
         sheildPower.getHeight(null),
         this);
   } else if (player1.getPower().equals("Umbrella")) {
     g.drawImage(
         umbrellaPower,
         player1.getX() - (umbrellaPower.getWidth(null) / 2) + 20,
         player1.getY() - umbrellaPower.getHeight(null) + 40,
         umbrellaPower.getWidth(null),
         umbrellaPower.getHeight(null),
         this);
   } else if (player1.getPower().equals("")) {
   }
 }
Exemplo n.º 5
0
 public void drawPowerUpIcon(Graphics g) {
   // draws the powerup the player has on the top
   if (player1.getPower().equals("Umbrella")) {
     g.drawImage(
         new ImageIcon("gamelayerstuff/powerups/UmbrellaSymbol.png").getImage(), 200, 10, this);
   } else if (player1.getPower().equals("Ball")) {
     g.drawImage(
         new ImageIcon("gamelayerstuff/powerups/BallSymbol.png").getImage(), 200, 10, this);
   } else if (player1.getPower().equals("Boost")) {
     g.drawImage(
         new ImageIcon("gamelayerstuff/powerups/BoostSymbol.png").getImage(), 200, 10, this);
   } else if (player1.getPower().equals("Balloon")) {
     g.drawImage(
         new ImageIcon("gamelayerstuff/powerups/BalloonSymbol.png").getImage(), 200, 10, this);
   } else if (player1.getPower().equals("Sheild")) {
     g.drawImage(
         new ImageIcon("gamelayerstuff/powerups/SheildSymbol.png").getImage(), 200, 10, this);
   } else if (player1.getPower().equals("Magnet")) {
     g.drawImage(
         new ImageIcon("gamelayerstuff/powerups/MagnetSymbol.png").getImage(), 200, 10, this);
   } else {
     g.drawImage(new ImageIcon("gamelayerstuff/powerupbox.png").getImage(), 200, 10, this);
   }
 }