Well, I'm trying to make a camera that follows the character, and I'm guiding myself with chatgtp, so as not to ask everything, but I have a problem/error that not even botgtp can find.
The Error(8,20): Expected ',' or '.'
(the script is from chatgtp, in fact, I don't even know if it works for a camera that follows
the character).
(The line that appears in red is that of: func _process(delta: float): )
Here is the script:
class CameraFollower extends Sprite:
export var velocity = 10
func _process(delta: float):
var velocity = Vector2()
if Input.is_action_pressed("move_right"):
vel.x += velocity*delta
var global_position = get_global_transform().origin
var destination = get_viewport().get_camera().project_position(global_position)
var direction = destination - global_position
direction = direction.normalized()
move_and_slide(direction * velocity * delta)