extends CharacterBody2D
const SPEED = 180
const JUMPFORCE = -950
const GRAVITY = 40
func _physics_process(delta):
if Input.is_action_pressed("right"):
velocity.x = SPEED
if Input.is_action_pressed("left"):
velocity.x = -SPEED
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMPFORCE
velocity.y += GRAVITY
move_and_slide()
velocity.x = lerp(velocity.x, 0.0, 0.1)