Exemplo n.º 1
0
 public static void main(String[] args) {
   ActorWorld world = new ActorWorld();
   Jumper alice = new Jumper();
   alice.setColor(Color.ORANGE);
   world.add(new Location(5, 5), alice);
   world.show();
 }
 /**
  * Adds two different Jumpers to a world, one with its color changed to Orange
  *
  * @param args
  */
 public static void main(String[] args) {
   ActorWorld world = new ActorWorld();
   Jumper alpha = new Jumper();
   alpha.setColor(Color.ORANGE);
   Jumper beta = new Jumper();
   world.add(new Location(7, 8), alpha);
   world.add(new Location(5, 5), beta);
   world.show();
 }
Exemplo n.º 3
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.º 4
0
 public void scrollJumpers() {
   for (Jumper i : jumperList) {
     i.setY(i.getY() + (int) (player1.getVelocity() * 0.3));
   }
 }
Exemplo n.º 5
0
 public void drawJumper(Graphics g) {
   for (Jumper i : jumperList) {
     g.drawImage(i.getImage(), i.getX(), i.getY(), i.getWidth(), i.getHeight(), null);
   }
 }