Hey, I was trying to make my first 2D game. But my Jump is stuttering very strangely.
I tried to look for solution on the Internet but i haven’t found anything.
Can someone help me?
My player is teleporting to the highest point and then drops.
@export var gravity : int = 3000 @export var speed : int = 120 @export var jump_velocity : int = 2000
func _physics_process(delta):
var direction = Input.get_axis("move_left", "move_right")
if direction:
velocity.x = direction * speed
else:
velocity.x = 0
#Gravity
if not is_on_floor():
velocity.y = gravity * delta
else:
velocity.y = 0
#jump
if Input.is_action_pressed("jump") and is_on_floor():
Jump(delta)
move_and_slide()
Gravity should be added to velocity.y: velocity.y += gravity * delta
I think you’ll have to lower the jump_velocity, maybe gravity too, but you’ll see if you test it this way.