I've never seen such a mistake, please help

Godot Version

Godot 4.6.1

Question

I was doing an animation for opening the door and this error occurred:

func _on_door_open_animate_body_entered(body: Node2D) -> void:
		if: body.name != "Player"
		return

Expected conditional expression after “if”.

error

if you ask why there is a colon in “if”, then I will answer that I am forced to put it there.

Colon is in totally wrong place and the indentation is wrong too.

func _on_door_open_animate_body_entered(body: Node2D) -> void:
	if body.name != "Player":
		return
2 Likes

the indentation is fine

but thank you

No, the indentation is not fine. The code lines following if line must be indented.

1 Like