extends KinematicBody2D var velocity = Vector2() func _ready(): pass # Replace with function body. func get_input(): velocity = Vector2() if Input.is_action_pressed("ui_right"): velocity.x += 1 if Input.is_action_pressed("ui_left"): velocity.x -= 1 if Input.is_action_pressed("ui_up"): velocity.y -= 1 if Input.is_action_pressed("ui_down"): velocity.y += 1 velocity = velocity.normalized() * 5000 func _physics_process(delta): get_input() velocity = move_and_slide(velocity * delta)