Can someone help ?

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

Yesterday I posted a question saying that my Godot is not working properly, someone commented that probably i missed a colon, I tryed, and nothing happened.

I really think is a bug, and i saw that to report bugs, you need to post then at github. But i don’t know how to use github, so, i came here.

I was doing a game, and in the middle of the code, suddenly, an error message appeared, saying “Error parsing expression, misplaced: func”.

Here is the code, and many errors, when i retire one, another appears

(I know i can improve the code, i’m just entering this world)


extends Node2D

var tile_size_x = 60
var tile_size_y = 60
var tile_selected = null
var Moves = null
var Moves2 = null
var piece =  null
var Checker = null
var check = 0
var clicked = false

onready var possible_moves= preload("res://Control.tscn")
onready var piece_checker = preload ("res://Area2D.tscn")

func _ready():

	var tile_quant = (480 / tile_size_x) * (480 / tile_size_y)
	tile_selected = 1

func has_piece():
	if check == 1:
		check = 0
	if check == 2:

func _checker():
	Checker = piece_checker.instance()
	Checker.connect("area_entered", self, "_on_area_entered")
	Checker.position.x = piece.rect_position.x + 90
	Checker.position.y = piece.rect_position.y + 90
	check = 1

func _move_piece():
	Moves = possible_moves.instance()
	Moves.connect("pressed", self, "_on_Moves_pressed")
	Moves.rect_position.x = piece.rect_position.x + 60
	Moves.rect_position.y = piece.rect_position.y + 60
	Moves2 = possible_moves.instance()
	Moves2.connect("pressed", self, "_on_Moves2_pressed")
	Moves2.rect_position.x = piece.rect_position.x - 60
	Moves2.rect_position.y = piece.rect_position.y + 60
func _on_TextureButton_pressed():
	piece = $Pieces/TextureButton

func _on_Moves_pressed():
	piece.rect_position.x = Moves.rect_position.x
	piece.rect_position.y = Moves.rect_position.y
	clicked = false
func _on_Moves2_pressed():
	piece.rect_position.x = Moves2.rect_position.x
	piece.rect_position.y = Moves2.rect_position.y
	clicked = false

func _on_area_entered(area):
	check = 2
	print("Ta fun")

func _on_TextureButton2_pressed():
	piece = $Pieces/TextureButton2
	if clicked == false:
		clicked = true
:bust_in_silhouette: Reply From: jgodfrey

I assumed you’d continue the conversation in the original thread here:

Anyway, thanks for posting the code.

Your problem is on line 30 where you’re missing a closing ).


That should be:

:bust_in_silhouette: Reply From: Szesan

How would it be a bug?
The parser clearly tells you that you have a syntax error.
It can’t parse your code because the “func” token is unexpected at that place. It even tells you that the problem lies in the line 32.

The only thing you have to do is look at line 32 and see why the func keyword is unexpected, then you’ll see that there is an unclosed bracket just before it.

You have to learn that when it comes to coding, in the overwhelming majority of cases you are at fault, not the engine, parser, IDE, complier, runtime or anything else.