What is causing this error?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Amanda Dearheart

To my knowledge, I type in the syntax of the code correctly. so why is this happening?

extends Control
onready var GF = get_node(“gf”); # node that contains re-useable game functions

func DisplayTitle():
# Compnay logo
get_tree().changescene(“res://scenes/Splash.tscn”); # Splash screen (game title)
# Display tools used to create game
func GameSetUp():
# Setup
# ----- setup database
# ----- load graphics
# ----- setup game board

func GameLoop():

game loop

----

----

----

end game

end credits

The error that it generates says the after 16.,1 GameSetUp function, there should be an indented block.

:bust_in_silhouette: Reply From: godot_dev_

I sounds like you have an indentation issue in your code. You might have a line of code that has whitespace as indents instead of tabs (e.g., if you copy pasted code). It will be difficult for someone to help you because your code is not formatted in your post, since we can’t see what is forum post formatting issues vs. actual code formatting issues. Make sure to format it so we can try and help you

:bust_in_silhouette: Reply From: jgodfrey

Yeah, the lack of code formatting makes this difficult to diagnose. However, if the above is actually your code, I assume this issue is here:

func GameSetUp():
# Setup
# ----- setup database
# ----- load graphics

That function doesn’t have any actual code in it. The minimal thing you can do to make that work is to add a pass in the function body (so, indented).

func GameSetUp():
    pass
# Setup
# ----- setup database
# ----- load graphics

@godot_dev, jgodfrey,

Thanks to the both of you. Yes, that was the problem, no code in the block.

@jgodfrey,

Thanks for the pass suggestion. I will try that in the future!

Amanda Dearheart | 2022-12-11 23:18