why is the jump not working? I did everything right... really?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By plov
var vel = Vector2()

var speed = 200
var jump = 1000
const gravity = 500
const FLOOR = Vector2(0, -1)

func _physics_process(delta):
if Input. is_action_pressed(“player_left”):
vel.x = -speed
elif Input. is_action_pressed(“player_right”):
vel.x = speed
else:
vel.x = 0

if Input. is_action_pressed("player_jump"):
	vel.y = -jump


vel.y = gravity

move_and_slide(vel)
:bust_in_silhouette: Reply From: Moot Point

Try

vel = move_and_slide(vel, Vector2.UP)

also vel.y += gravity and put it way lower, should do the trick.