I have a problem. If i move the player with a or d it stutters at regular intervals. If i jump and still hold the buttons it stops until the player stops and this goes on and on.
Code:
extends KinematicBody2D
var velocity = Vector2(0,0)
const SPEED = 180
const JUMPFORCE = -300
const GRAVITY = 10
func physicsprocess(delta):
if Input.isactionpressed("right"):
velocity.x = SPEED
if Input.isactionpressed("left"):
velocity.x = -SPEED
velocity.y = velocity.y + GRAVITY
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMPFORCE
velocity = move_and_slide(velocity,Vector2.UP)
velocity.x = lerp(velocity.x,0,0.2)