- Home /
I want to move the player once while he is jumping
So this is my move function which move the player and stop it form moving if he isn't on the ground and my bool var can move while jumping is set to false So please help me i can't figerout how to make my player move once while jumping just once in order to make my platforme game look more realistic thank you so much if this question is alredy has been asked plzz provide the link or a forum thred thank you so so so much
Answer by juicyz · Feb 02, 2017 at 11:11 PM
holy moly batman, so many colors. Anyways...
Can you show me the whole Move() code and how you are making the player jump. Also don't put it in a picture. Copy and paste the code then use the nice code formatter button on the text gui bar. Though I think you can get away with the following code:
// I'm assume player is on ground at first because I can't tell...
bool isGrounded = true
bool canMovWhileJumping = true;
// When player jumps set isGrounded to false.
// When player is on ground, set isGrounded and canMovWhileJumping to true
void Move() {
if (!isGrounded && !canMovWhileJumping)
return;
// All the cool move code
// Do this at the end so the code runs one time
if (!isGrounded)
canMoveWhileJumping = false;
}