Example #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;
    }
  }
Example #2
0
 public void kill() {
   kill(false);
 }