0 votes

this is what i have for physics process function:

velocity = move_and_slide_with_snap(velocity, Vector2.UP)
velocity.x = 0
velocity.y += gravity * delta

if Input.is_action_pressed("left"):
    velocity.x -= speed 
if Input.is_action_pressed("right"):
    velocity.x += speed

if Input.is_action_just_pressed("jump"):
    if is_on_floor():
        velocity.y = jump_speed

for some reason the jump doesnt work and i cant seem to figure it out.

Godot version editor.godotengine.org/releases/latest
in Engine by (12 points)

1 Answer

0 votes

The line velocity = move_and_slide_with_snap(velocity, Vector2.UP) should be at the bottom of that code.

by (3,062 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 Frequently asked questions and 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 [email protected] with your username.