+1 vote

Hi I'm very new to coding so I chose Godot as I believed it is perfect for beginners. I wrote "if Input.isactionpressed("up"):" for a line of code and it appears as an error with the words " Unexpected Token if:" I don't know if I should be worried about that or not. Please tell me if I have done anything wrong.

Thank you!

in Engine by (13 points)

Could you please post a screenshot of the line and the warning?

1 Answer

+1 vote

If I had to guess you are attempting to use this code outside a function to run it from.
So for example:

Func _proccess(Delta): #This here is a function that runs at every frame of your game
 If Input.is_action_pressed(): #if key is pressed. Do thang.

Hopefully this helps. ^-^

by (59 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 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 webmaster@godotengine.org with your username.