Following instructions from tutorial for top down movement and got that error message, my code looks like this:
Movement where the character rotates and moves forward or backward.
extends CharacterBody2D
Movement speed in pixels per second.
export var speed := 500
Rotation speed in radians per second.
export var angular_speed := 5.0
func _physics_process(delta):
# See how we’re using Input.get_action_strength() to calculate the direction we rotate.
# The value will be in the [-1.0, 1.0] range.
var rotate_direction := Input.get_action_strength(“Turn Right”) - Input.get_action_strength(“Turn Left”)
rotation += rotate_direction * angular_speed * delta
# Below, we calculate the forward or backward move direction and directly multiply it to calculate a velocity.
# transform.y
stores the node’s local axes, allowing us to move it in the direction it’s currently facing.
var velocity := (Input.get_action_strength(“Turn Around”) - Input.get_action_strength(“Walk”)) * transform.y * speed
move_and_slide(velocity)
“extends CharacterBody2d” and “export var speed := 500” are where the error message pops up.