Parser Error: The identifier "movement" isn't declared in the current scope. I cant figure out why my code isnt working

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Gerald1212
extends KinematicBody

const MIN_CAMERA_ANGLE = -60

export var camera_sensitivity: float = 0.05
export var speed: float = 10
var velocity: Vector3 = Vector3.ZERO

onready var head: Spatial = $Head

func _ready():

func _physics_process(_delta):
var movement = _get_movement_direction()

velocity = movement * speed
velocity = move_and_slide(velocity)

func _unhandled_input(event):
if event is InputEventMouseMotion:

func _handle_camera_rotation(event):
rotate_y(deg2rad(event.relative.x * camera_sensitivity))
head.rotate_x(deg2rad(-event.relative.y * camera_sensitivity))
head.rotation.x = clamp(head.rotation.x, deg2rad(MIN_CAMERA_ANGLE), deg2rad(MAX_CAMERA_ANGLE))

func _get_movement_direction():
var direction = Vector3.DOWN

	if Input.is_action_pressed("forward"):
		direction -= transform.basis.z
	if Input.is_action_pressed("backwards"):
		direction += transform.basis.z
	if Input.is_action_pressed("left"):
		direction -= transform.basis.x
	if Input.is_action_pressed("right"):
		direction += transform.basis.x
		return direction
:bust_in_silhouette: Reply From: Inces

Error does not originate in this part of code. You introduced var movement as local variable for physics_process(), but You must have used it somewhere out of this function, and this somewhere is provoking error. You can read which line of code your error is.