Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualultramailman

Posted 03 June 2014 - 04:52 PM


How to prevent the character from jumping again if it is already in a "jumping state"?

 

Your question kind of answers your question.

Make separate states for "initiating the jump" and "jumping" (I like to call it "falling").

if(spacePressed && (state != ActionState.JUMPING))
{
state = ActionState.JUMP;
}
else if(state == ActionState.JUMP) // .... and then in the next frame
{
state = ActionState.JUMPING;
}

#4ultramailman

Posted 03 June 2014 - 04:52 PM


How to prevent the character from jumping again if it is already in a "jumping state"?

 

Your question kind of answers your question.

Make separate states for "initiating the jump" and "jumping" (I like to call it "falling").

if(spacePressed && (state != ActionState.JUMPING))
{
state = ActionState.JUMP;
}
else if(state == ActionState.JUMP) // .... and then in the next frame
{
state = ActionState.JUMP;
}

#3ultramailman

Posted 03 June 2014 - 04:51 PM


How to prevent the character from jumping again if it is already in a "jumping state"?

 

Your question kind of answers your question.

Make separate states for initiating the jump and jumping (I like to call it "falling").

 

if(spacePressed && (state != ActionState.JUMPING))
{
state = ActionState.JUMP;
}
else if(state == ActionState.JUMP) // .... and then in the next frame
{
state = ActionState.JUMP;
}

#2ultramailman

Posted 03 June 2014 - 04:40 PM


How to prevent the character from jumping again if it is already in a "jumping state"?

 

Your question kind of answers your question.

Make separate states for jump and jumping.

if(spacePressed && (state != ActionState.JUMPING))
{
state = ActionState.JUMP;
}

#1ultramailman

Posted 03 June 2014 - 04:39 PM


How to prevent the character from jumping again if it is already in a "jumping state"?

 

Your question kind of answers your question.

 

if(spacePressed && (state != ActionState.JUMPING))
{
state = ActionState.JUMPING;
}

PARTNERS