Exemplo n.º 1
0
  private void updatePosition() {
    updatePosLast();

    pos.setLocation(pos.x + vel.x * Wuigi.time(), pos.y + vel.y * Wuigi.time());

    if (!dead && pos.y + Wuigi.GROUND_LEVEL < 0) {
      kill(true);
      // pos.y = pos.y + Wuigi.GROUND_LEVEL + 1;
      falling = false;
    } else if (pos.y < 0 && !dead && !piped && (!falling || invulerable)) {
      setPos(pos.x, 0);
      // yOffset = Wuigi.GROUND_LEVEL;
    }

    if (pos.x > lastX + 20 || pos.x < lastX - 20) {
      rightFoot = !rightFoot;
      lastX = pos.x;
    }
    if (piped && pos.y + height < lineToCross && vel.y < 0) changeWorlds = true;
    if (piped && pos.y > lineToCross && vel.y > 0) {
      vel.y = 0;
      pos.y = lineToCross;
      piped = false;
    }
  }
Exemplo n.º 2
0
 /**
  * determines if the player finished moving through a pipe and needs to change to the connected
  * pipe
  *
  * @return true if finished moving through a pipe, false if not
  */
 public boolean piped() {
   boolean p = changeWorlds;
   if (p) {
     piped = false;
     setPos(pos.x, (double) lineToCross);
     vel.y = 0;
   }
   changeWorlds = false;
   return p;
 }
Exemplo n.º 3
0
 public void setPos(Point2D.Double pos) {
   setPos(pos.x, pos.y);
 }
Exemplo n.º 4
0
 /** sets the respawn position */
 public void setDeathPos() {
   setPos(deathPos.x, deathPos.y);
 }