Help moving character

Godot Version

4.6.2

Question

I seem to be having trouble getting my character to move, this is my current script, is there something I’m doing wrong?

func _process(_delta: float):
	
	var direction : Vector2 = Vector2.ZERO
	direction = Input.get_vector("Move Left", "Move Down", "Move Right", "Move Up")
	
	velocity = direction * move_speed * _delta
	
	pass

func _physics_process(_delta):
	move_and_slide()

Do you get any error message?
Do you have the inputs properly added to your Input Map in the project settings? Usually it’s not a good idea to have spaces in the input names.

I think its because your multiplying velocity with delta, even though move_and_slide() will already multiply it by delta.

something like this can work:

func _process(_delta: float):
	
	var direction : Vector2 = Vector2.ZERO
	direction = Input.get_vector("Move Left", "Move Right", "Move Up", "Move Down")
	
	velocity = direction * move_speed
	

func _physics_process(_delta):
	move_and_slide()

take a look at “move_and_slide()” in the docs

1 Like