I took the code from the 2d movement overview and it almost does what I want it to do, I still have the issue where if the mouse is on the player the player wont move, and it doesn't have strafing side to side.
export (int) var speed = 500
var velocity = Vector2()
func get_input():
look_at(get_global_mouse_position())
velocity = Vector2()
if Input.is_action_pressed("down"):
velocity = Vector2(-speed, 0).rotated(rotation)
if Input.is_action_pressed("up"):
velocity = Vector2(speed, 0).rotated(rotation)
func _physics_process(delta):
get_input()
velocity = move_and_slide(velocity)