Sorry getting used to this but what??? the indents are not where i would expect them to be

shouldn't it be more like this?

the editor will not have it!!

That is up to you. It is import that all indents of a codeblock are the same. That said, if you use zwo tabs like in your second version, all lines of your codeblock need to use two tabs. If you want to use more, all of your lines need to use more.

I think the reason the editor is complaining about the indents and having strange requirements is because the other code, above the code you marked, uses spaces for indentation rather than tabs. That is why the little grey arrows (>|) before the code are not visible on lines 9 -> 24.

If I recall correctly, you can convert from spaces to tabs in Godot's script editor. I think it is under the edit menu. Let me know if you cannot find it and I'll see if I can get a screenshot of it.

Once you have all of your code using either spaces or tabs, then you should be able to use a consistent amount of spaces/tabs across your code. :smile:

In python it is recommended to use spaces instead of tabs. Godots scripting language is based on python syntax. Maybe just use this style for your scripts.

@TwistedTwigleg said: I think the reason the editor is complaining about the indents and having strange requirements is because the other code, above the code you marked, uses spaces for indentation rather than tabs. That is why the little grey arrows (>|) before the code are not visible on lines 9 -> 24.

If I recall correctly, you can convert from spaces to tabs in Godot's script editor. I think it is under the edit menu. Let me know if you cannot find it and I'll see if I can get a screenshot of it.

Once you have all of your code using either spaces or tabs, then you should be able to use a consistent amount of spaces/tabs across your code. :smile:

thanks Twisted, can't find the convert. i'll read up more on this in the docs' and just purchased a book.

@Schorsch said: In python it is recommended to use spaces instead of tabs. Godots scripting language is based on python syntax. Maybe just use this style for your scripts.

The GDScript style guide recommends using tabs for indentation, which is why the script editor defaults to tabs.

@Calinou said:

@Schorsch said: In python it is recommended to use spaces instead of tabs. Godots scripting language is based on python syntax. Maybe just use this style for your scripts.

The GDScript style guide recommends using tabs for indentation, which is why the script editor defaults to tabs.

great stuff, thanks.

4 years later