0 votes

Hi! I'm having a error pop up after i enter in my code to see second person. here is my code (Thank you Zylann!): func process(delta):
# vertical
if Input.is
keypressed(KEYW): # do action here
elif Input.iskeypressed(KEY_S): # do action here

# horizontal
if Input.iskeypressed(KEYA): # do action here
elif Input.is
keypressed(KEYD): # do action here

If you can see the problem, than please tell me what it is, and how i can fix it! Or if you have a different code, that will allow me to see see second person, than please tell me, because i will try it! ( it said the error was: error (14, 1): Expected idented block after if, so plz tell me what that means if you know!

in Engine by (43 points)

enter a pass after every if(in their block instead of the comment) until you fill it out, you have blocks of code with no proper code in them right now, by adding the pass method it will solve the error and you can always remove it and put a different code in there(proper one)

You should edit the question and mark you code as a code sample so we can see it better. You can do that by selecting the code and pressing Ctrl+K or by pressing the curly braces button.

1 Answer

0 votes
Best answer

Whenever an error has a tuple, it's showing you where the error is. In your case, you have (14, 1) which means the 14th line, 1st character. So you should check there. The description part of your error message Expected idented block after if means that you didn't indent after an if statement. In GDScript and Python (which GDScript is based on) there are no code block braces, instead you must indent with whitespace.

Typical programming language:

if (condition) {

Python / GDScript:

if (condition):

Notice the colon and indentation? Whereas in a typical programming language indentation is optional, in Python and GDScript it is required. You can easily create indentation with the Tab ↹ key. The editor in Godot with mark tab characters with a double right arrow quote (»).

That being said, there seem to be other errors in your code. Here is how your intended code should look.

func _process(delta):
    ## Vertical

    ## Horizontal
by (97 points)
selected by
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.