public void setVelocityY() { System.out.println("up: " + up + ", down: " + down); int multiple = 0; if (up > down) { multiple = 1; } else if (down > up) { multiple = -1; } pc.setVelocityY(VERTICAL_VELOCITY * multiple); }
public void setVelocityX() { System.out.println("left: " + left + ", right: " + right); int multiple = 0; if (left > right) { multiple = -1; } else if (right > left) { multiple = 1; } pc.setVelocityX(HORIZONTAL_VELOCITY * multiple); }