–1 vote

I keep getting this error.
error(9,1): Unexpected token: Identifier:velocity
the line I wrote: velocity = speed * direction
(for my 2d movement)

Godot version 3.5.1 stable
in Engine by (11 points)

Typically this error has to do with where you've written that line of code. For example, you can't execute code like this outside of a function body.

Please post your entire script, as it's impossible to be specific without seeing the context of where this line of code is.

Where is velocity declared?

1 Answer

0 votes

Your code is in the wrong place.

by (939 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.