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; } }
/** * 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; }
public void setPos(Point2D.Double pos) { setPos(pos.x, pos.y); }
/** sets the respawn position */ public void setDeathPos() { setPos(deathPos.x, deathPos.y); }