character moving

Your CharacterBody2D has an error, I would bet it’s missing a CollisionShape2D

Your script is editing velocita but that is a variable you created, editing the base class’ velocity will allow you to use move_and_slide

Try something like this as your script

extends CharacterBody2D

const MAX_SPEED: float = 500
const ACCELERATION: float = 50

func _physics_process(delta: float) -> void:
	var input: Vector2 = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
	velocity = velocity.move_toward(input * MAX_SPEED, ACCELERATION * delta)

	move_and_slide()

Make sure to paste scripts isntead of screenshots.

1 Like