Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Player::Jump()
- {
- if (!peakJumpPoint)
- peakJumpPoint = body.y - jumpHeight;
- }
- void Player::ApplyJumpMotion()
- {
- // If jumping (peakJumpPoint should be 0 if not jumping)
- if (peakJumpPoint)
- {
- if (body.y <= peakJumpPoint)
- {
- if (jumpCalls >= game::maxJumpCalls)
- {
- shouldFall = true;
- peakJumpPoint = 0;
- jumpCalls = 0;
- }
- else
- jumpCalls++;
- }
- else
- {
- shouldFall = false;
- body.y -= jumpSpeed;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement