Delta not working as I expect it to

Question

I noticed that when I set my pc to run at 30 fps in nvidia control panel, my character started moving faster. I timed the movement, and the time it took to get to the end of the screen at 30 fps was around 1.5 seconds, and 60 was around 2.4 ish
I wanted to know if I did anything wrong with the delta calculations.

extends CharacterBody2D
var walkspeed = 25000

func _process(delta):
	#calculate movement
	var xdir = int(Input.is_action_pressed("move_right")) - int(Input.is_action_pressed("move_left"))
	var ydir = int(Input.is_action_pressed("move_down")) - int(Input.is_action_pressed("move_up"))
	var velocity = Vector2(xdir, ydir).normalized() * walkspeed * delta
	set_velocity(velocity)
	move_and_slide()
	


Just don’t multiply your velocity by delta, move_and_slide() already apply it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.