Esempio n. 1
0
 /** pide al mundo la velocidad y hace caer el obstaCULO con una disminucion de 1 */
 public void caer() {
   int x = getX();
   BlurWorld mundo = (BlurWorld) getWorld();
   int vel = mundo.dameVel() - 1;
   this.setLocation(getX(), getY() + vel);
   if (getY() > mundo.getHeight() - 10) {
     mundo.removeObject(this);
     // mundo.creaBarra(x,50);
   }
 }
Esempio n. 2
0
 /** las esferas giraran dependiendo de la tecla que se presione */
 public void mueve() {
   BlurWorld mundo = (BlurWorld) getWorld();
   vel = mundo.dameVel() + 1;
   if (Greenfoot.isKeyDown("left")) {
     int rotationalSpeed = -vel;
     setLocation((ROWS / 2), (COLS / 2) + 220);
     turn(rotationalSpeed + 90);
     move(radius);
     turn(-90);
   }
   if (Greenfoot.isKeyDown("right")) {
     int rotationalSpeed = vel;
     setLocation((ROWS / 2), (COLS / 2) + 220);
     turn(rotationalSpeed + 90);
     move(radius);
     turn(-90);
   }
 }
Esempio n. 3
0
  /** si la esfera golpea se le resta a la variable health por medio del metodo loseHealth */
  public void golpear() {
    BlurWorld mundo = (BlurWorld) getWorld();

    World myWorld = getWorld();

    BlurWorld blurworld = (BlurWorld) myWorld;

    HealthBar healthbar = blurworld.getHealthBar();
    healthbar.loseHealth();

    int x = getX(), y = getY();

    mundo.removeObject(this);
    mundo.addObject(new ExplosionRoja(), x, y);
    mundo.iniTiExp();
  }