I am trying to make the camera jump in my LWJGL program. I've tried writing an if/else statement that would say, "when you get to this position, go to default, starting position." So far it just continues to fly up. Here's my code:
if (flyUp && !flyDown) {
double newPositionY = (walkingSpeed * 0.0002) * delta;
position.y -= newPositionY;
if(position.y > .0002) {
position.y += newPositionY;
}
}
Variables:
boolean flyUp = Keyboard.isKeyDown(Keyboard.KEY_SPACE);
boolean flyDown = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT);
You don't have anything to bring you back down (as far as I can see).
Add some gravity?
// After your if statement
position.y -= gravity * delta;
Also, I'm not sure the reason, but I wouldn't generally recommend using the walking speed as the jump speed. :)