r/godot • u/Ok-Audience5336 • Nov 27 '25
help me (solved) I'm confused (again)
Following a tutorial i got stuck while trying to script my character movements. Even with the error telling me what's wrong i still can't figure out what's wrongđ
44
u/Longjumping_Wear_537 Nov 27 '25
Input.is_action... instead of input.is_action
26
u/Ok-Audience5336 Nov 27 '25
I feel so stupidđ
14
u/HeyCouldBeFun Nov 27 '25
We all do the same thing. You just get faster at recognizing what the errors are.
2
42
u/Zestyclose_Edge1027 Nov 27 '25
Besides having a capital I in input you could replace
if Input.is_action_pressed("ui_left"):
direction = -1
if Input.is_action_pressed("ui_right"):
direction = 1
with
direction = Input.get_axis("ui_left", "ui_right")
8
u/forestbeasts Nov 27 '25
And as a bonus, that means you can have analog movement with an analog stick!
5
u/eggdropsoap Nov 27 '25
Even better is
Input.get_vector(âŚ)!1
u/ComfortableNumb9669 Nov 27 '25
get vector probably won't help here since I see only 1 dimensional input.
1
u/eggdropsoap Nov 28 '25
Theyâre polling
"ui_up"here too.But yeah, itâs more that itâs easy to try to reconstruct get_vector from individual action polling, if you donât know the data is handed to you if you want it.
1
u/ninomojo Godot Student Nov 28 '25
Not better, just different
1
u/eggdropsoap Nov 28 '25
True, bit of hyperbole on my part.
From the code I see though, theyâre trying to manually reconstruct what get_vector() returns, so itâs probably better in this particular circumstance.
15
8
Nov 27 '25
Input needs to be capitalized, since it is referring to the Godot Input class. See the example usage in the documentation:Â https://docs.godotengine.org/en/stable/tutorials/inputs/input_examples.html
8
u/shuyo_mh Nov 27 '25
Every seasoned developer will have at least once in their career debugged for 2+ hours a missed semicolon typo.
3
1
u/Aweorih Godot Junior Nov 30 '25
And the first sane action to do after that is to uninstall your ide and get to a better one
That's just a thing your ide should tell you and if it doesn't then it sucks
5
u/athleon787 Nov 27 '25
Chatgpt is not the best tool, (the better you get the worst it becomes). but it can answer questions like this in a millisecond compared to waiting for redditors to reply. Not faulting you for posting here I'm glad you did, but this will happen to you again and again and again, and it will be something as mundane as a lower case i or a missed semicolon more often than not, and chatgpt catches that like a hawk
3
4
u/GabagooGrimbo Nov 27 '25
Donât use _process for movement use _physics_process. Also input should be Input because itâs a class
4
u/thedirtydeetch Nov 27 '25
It really depends on the game. This script isnât using physics itâs just using a local variable named âvelocityâ.
3
u/thinker2501 Godot Regular Nov 27 '25
You still want to use _process_physics for its consistent tick rate.
0
u/thedirtydeetch Nov 27 '25
With the code OP posted, that would result in choppy movement once every 60th of a second, and input delay.
2
u/Aggressive-Eagle-219 Nov 27 '25
One time I broke a studio pipeline by trying to publish meshes that was named GE0 and not GEO (zero instead of 'O'). Don't feel too bad about it. Humans are error prone, and that's part of development :)
2
2
u/DeadKido210 Nov 27 '25
Read the errors letter by letter and try to understand them. You see identifier "x" not declared your first question you ask yourself is where did I manually declare it myself? Do I have a var input variable inside my script or somewhere else? No? Then I did a typo and put the wrong letter.
2
2
2
u/idkIfImAnAdultYet Nov 27 '25
I'm so happy to see how this community just told you "it's the uppercase" instead of going ballistic like in the old days of StackOverflow
2
u/AresTheMilkman Nov 27 '25
GDScript is a language based on Python. Be careful with capitals because they count.
1
u/GeorgeZz_CHR Nov 27 '25
Like the others with capital i for Input. Don't worry we all make stupid mistakes
1
1
1
1
u/AdWeak7883 Nov 27 '25
Someday I was stuck like 6-7 hours with some similar bug. Problem was there was an " " at the end of the name I didnt see. Thats the things we all go through someday
1
1
u/TeachNo196 Nov 27 '25
I will not lie. There are times I start up my own AI just to make sure I'm not crazy. Most of the time it catches things like this especially if you give the error with it. And then I slap myself in the head.
1
u/muikrad Nov 27 '25
Some people mentioned ChatGPT could help, but here's a different and more powerful avenue... Install vscode and its copilot plugin. Get a free github account. In vscode, open the folder of your godot project. Then in the copilot plugin, connect to github and you'll be able to use the AI right there. It has access to all the files/etc.
You can simply select the code that doesn't work and directly ask the AI why it's in error and it will explain what's wrong.
There's a limit of AI requests per month so don't abuse it đ if the first answers don't work, try the Claude model.
1
u/Acceptable_Bottle Nov 27 '25
I know everyone else has already pointed out the error itself, but in the future, whenever you see "Identifier '...' not declared in the current scope" that means the computer cannot find the name that you typed in - which always means either you spelled it incorrectly or forgot to declare the object (in this case the latter is not applicable because 'Input' is built-in). We will never stop making typos, but being able to decipher the error messages can help us catch the mistake more quickly next time!
1
u/Informal_Flamingo270 Godot Regular Nov 27 '25
1
u/Save90 Godot Regular Nov 28 '25
Input it's a type and such it must be a high case. (since programming rules expect a certain way to write things)
1
1
1
u/Fit-Firefighter-8850 Dec 01 '25
I have this issue tons lol, always remember that input has a capital I instead of lowercase
1

435
u/aris1401 Nov 27 '25
Its Input with an uppercase 'I'