Exemplo n.º 1
0
 public void checkJumperCollision() {
   // same as all the other collsions
   for (Jumper j : jumperList) {
     if (j.getOnScreen()) { //
       if (j.checkCollision(j.getImage(), player1)) {
         player1.setVelo(50);
         player1.setDown(false);
         if (musicOn) {
           bounce.play();
         }
       }
     } else {
       jRemove.add(j);
     }
   }
   for (Jumper j : jRemove) {
     jumperList.remove(j);
   }
   jRemove = new ArrayList<Jumper>();
 }
Exemplo n.º 2
0
 public void checkSpikeCollision() { // checks the spike collision
   for (Spikes s : spikeList) {
     if (s.getOnScreen()) { // if the spike is on the screen
       if (s.checkCollision(s.getImage(), player1)) { // if the user collides with the spike
         if (player1.getInvi() == false) { // if player is not invisiblity
           player1.setSpikeVelo(); // set the spike velocity
           loseCoins();
           player1.setDown(true);
         }
         spRemove.add(s);
       }
     } else {
       spRemove.add(s); // remove the spike
     }
   }
   for (Spikes s : spRemove) {
     spikeList.remove(s);
   }
   spRemove = new ArrayList<Spikes>();
 }
Exemplo n.º 3
0
 public void checkBoxCollision() { // pretty much the same thing as all the other collisions
   for (Box b : boxList) {
     if (b.getOnScreen()) { // checks if its on the screen
       if (b.checkCollision(b.getImage(), player1)) {
         player1.setVelo(50);
         player1.setDown(false);
         b.setPcount(
             b.getPcount() - 1); // sets the type to one less so then you can  bounce on it twice
         if (b.getPcount() == 0) {
           bRemove.add(b); // removes the box
         }
         if (musicOn) {
           bounce.play();
         }
       }
     } else {
       bRemove.add(b);
     }
   }
   for (Box b : bRemove) {
     boxList.remove(b);
   }
   bRemove = new ArrayList<Box>();
 }
Exemplo n.º 4
0
 public void checkCoinCollision() {
   for (Coin c : coinList) {
     if (c.getOnScreen()) { // check if the coin is on the screen
       if (c.checkCollision(
           c.getPics().get(c.getCounter()), player1)) { // if the player collides with the coin
         cRemove.add(c); // remove the coin
         player1.setVelo(50); // set the velocity so the player moves up
         player1.setDown(false); // set the down false (players moving up)
         coins += c.getValue(); // check the coins collected
         score += c.getPoints(); // get the score
         if (musicOn) {
           coinSound.play(); // play the sound
         }
       }
     } else {
       cRemove.add(c); // remove the coin
     }
   }
   for (Coin c : cRemove) {
     poofList.add(new Poof(c.getX(), c.getY(), 0));
     coinList.remove(c);
   }
   cRemove = new ArrayList<Coin>();
 }