Topic was automatically imported from the old Question2Answer platform.
Asked By
AbdielDev
Good night
I am programming a 2d video game, when I am programming the player movement script, I get an error that says “error(7,10): Constants must be assigned immediately.” and I don’t know how to solve it, here I leave an image
Oh thank you very much, I already solved that problem but I got this other one
AbdielDev | 2023-05-15 02:25
Your images aren’t working in the forum (I can get the URL by editing your post). Rather that posting images of code, you’re better off posting the code itself (formatted for the forum) as well as the complete error message(s).
In this case, you have a variable (motion) that hasn’t been declared (as the error states). By the look of the surrounding code, I assume it’s a Vector2 and should be declared as a script-level variable. So, somewhere near the top - outside of any function, add this: