extends KinematicBody2D
var velocity = Vector2()
var speed = 250
var gravity = 1200
var jump_speed = -500
func _physics_process(delta):
velocity.x = 0
if Input.is_action_pressed("ui_right"):
velocity.x = speed
elif Input.is_action_pressed("ui_left"):
velocity.x = -speed
velocity.y += gravity * delta
if is_on_floor() and Input.is_action_just_pressed("ui_accept"):
velocity.y = jump_speed
velocity = move_and_slide(velocity, Vector2(0, -1))⚠️Content was pasted as plain text and auto-formatted as a code block. Use the Code Block button in the editor for proper formatting.