0 votes
if yspeed < 700:
    yspeed += GRAVITY

if yspeed < 0 and jump_hold == 0:
    yspeed = 0

Trying to make a Mega Man style jump where the longer you press the jump button, the higher the player can jump. However, the script I'm using for them the player releases jump before they're at the peak doesn't seem to work. My guess is having to do with the lower than symbol. I know I should use == during the IF statement to compare a variable, but should I use <= for the yspeed? Or is it something else?

in Engine by (172 points)

1 Answer

0 votes

u use
== if you want the excat value (dont do that with float values)
<= if you want a value that is equal or lower
< if you want a value that is lower

the snippet you posted does say much, what exactly does not work?

does he continue to accelerate?
does he stop moveing at all etc.

There is also an jump and run example for godot 2.2

by (289 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories