예제 #1
0
 public void scrollEnemies() {
   for (Enemy i : enemyList) {
     i.setY(i.getY() + (int) (player1.getVelocity() * 0.3));
     i.setYPos(i.getYPos() + (int) (player1.getVelocity() * 0.3));
     i.setYMax(i.getYMax() + (int) (player1.getVelocity() * 0.3));
   }
 }
예제 #2
0
 public void scrollCoins() {
   for (Coin i : coinList) {
     i.setY(i.getY() + (int) (player1.getVelocity() * 0.3));
     i.setYPos(i.getYPos() + (int) (player1.getVelocity() * 0.3));
     i.setYMax(i.getYMax() + (int) (player1.getVelocity() * 0.3));
   }
 }
예제 #3
0
 public void moveLayerThree(Graphics g) {
   backy += (int) (player1.getVelocity() * 0.1);
   midy += (int) (player1.getVelocity() * 0.5);
   drawEnemy(g);
   drawCoin(g);
   drawBox(g);
   drawPoof(g);
   drawStar(g);
   drawJumper(g);
   drawSpike(g);
   drawPup(g);
   if (backy <= dieHeight) {
     // System.out.println(die);
     g.drawImage(player1.move(2), player1.getX(), player1.getY(), this);
     if (player1.animationComplete()) {
       die = true;
     }
   } else {
     if (backy <= dieHeight) {
       player1.resetCounter();
     }
     if (keys[KeyEvent.VK_RIGHT]) {
       g.drawImage(player1.move(1), player1.getX(), player1.getY(), this);
     } else if (keys[KeyEvent.VK_LEFT]) {
       g.drawImage(player1.move(-1), player1.getX(), player1.getY(), this);
     } else {
       g.drawImage(player1.move(0), player1.getX(), player1.getY(), this);
     }
   }
 }
예제 #4
0
 public void checkEnemyCollision() {
   for (Enemy e : enemyList) {
     if (e.getOnScreen()) { // can be removed later on
       // goes through all the enemies and checks if they collide
       if (e.checkCollision(e.getPics().get(e.getCounter()), player1)) {
         if (player1.getInvi() == false) {
           // If the player is not invisble then you get spiked.
           if (player1.getVelocity() > 0) { // if the player hits it from the bottom
             player1.setSpikeVelo();
             loseCoins();
           } else {
             player1.setVelo(
                 50); // if the player is on top instead the player bounces off the enemy
             if (musicOn) {
               bounce.play();
             }
           }
         }
         eRemove.add(e); // once we hit, we remove the enemy
       }
     } else {
       eRemove.add(e); // if the enemy goes of the screen, we remove
     }
   }
   for (Enemy e : eRemove) {
     poofList.add(new Poof(e.getX(), e.getY(), 1)); // removes all the enemies
     enemyList.remove(e);
   }
   eRemove = new ArrayList<Enemy>();
 }
예제 #5
0
 public void scrollRects() {
   for (Rectangle i : rectList) {
     i.setLocation((int) (i.getX()), (int) (i.getY() + (int) (player1.getVelocity() * 0.3)));
   }
 }
예제 #6
0
 public void scrollPoofs() {
   for (Poof i : poofList) {
     i.setY(i.getY() + (int) (player1.getVelocity() * 0.3));
   }
 }
예제 #7
0
 public void scrollPowerUps() {
   for (Powerup i : pupList) {
     i.setY(i.getY() + (int) (player1.getVelocity() * 0.3));
   }
 }
예제 #8
0
 public void scrollDecorations() {
   for (Decorations i : decoList) {
     i.setY(i.getYTop() + (int) (player1.getVelocity() * 0.45));
   }
 }
예제 #9
0
 public void scrollSpikes() {
   for (Spikes i : spikeList) {
     i.setY(i.getY() + (int) (player1.getVelocity() * 0.3));
   }
 }
예제 #10
0
 public void scrollJumpers() {
   for (Jumper i : jumperList) {
     i.setY(i.getY() + (int) (player1.getVelocity() * 0.3));
   }
 }
예제 #11
0
 public void scrollStars() {
   for (Star i : starList) {
     i.setY(i.getY() + (int) (player1.getVelocity() * 0.3));
   }
 }
예제 #12
0
 public void scrollBoxes() {
   for (Box i : boxList) {
     i.setY(i.getY() + (int) (player1.getVelocity() * 0.3));
   }
 }