Yo, What's wrong with that?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dduardu
move_and_slide(motion)

error(16,1): Unexpected token: Identifier:move_and_slide

What’s wrong with this code?
Everytime i just write this code, i’ve been stoped by this error.

Can someone help me?

You’re probably going to need to provide more context (more surrounding code) here, but from the error message…

It seems like the code you pasted isn’t inside of a function. Instead, it’s apparently just bare code, at the top-level of a script file - which isn’t valid.

jgodfrey | 2023-04-21 23:40

Thanks! That’s correct, the code was outside the function.

dduardu | 2023-04-22 01:42

You probably need to put this kind of code in the _process(delta) function (this function is called once per frame)

Adrasteon | 2023-04-22 11:58

:bust_in_silhouette: Reply From: jgodfrey

Based on the above, the answer here was to ensure that the offending code was properly contained within a function.