extends CharacterBody2D
var movement = 500
func _ready():
pass
func _physics_process(delta):
var motion = Vector2()
if Input.is_action_pressed("up"):
motion.y -= 1 * movement
if Input.is_action_pressed("down"):
motion.y += 1 * movement
if Input.is_action_pressed("left"):
motion.x -= 1 * movement
if Input.is_action_pressed("right"):
motion.x += 1 * movement
motion = motion.normalized()
move_and_collide(motion)
This makes it move pretty smooth. If you keep movement * motion inside of the move _and_collide(), the character just zooms around the world crazy fast. and with what I’ve tried with move_and_slide(), it litteraly just dosent work.
One recommendation i’d make is this: motion.x += 1 * movement * delta
in each of the input if statements.