Attention | Topic was automatically imported from the old Question2Answer platform. | |
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)
IMAGES
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:
_move_piece()
check = 0
if check == 2:
Moves.queue_free()
Moves2.queue_free(
func _checker():
Checker = piece_checker.instance()
Checker.connect("area_entered", self, "_on_area_entered")
get_parent().add_child(Checker)
Checker.position.x = piece.rect_position.x + 90
Checker.position.y = piece.rect_position.y + 90
check = 1
has_piece()
func _move_piece():
Moves = possible_moves.instance()
Moves.connect("pressed", self, "_on_Moves_pressed")
get_parent().add_child(Moves)
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")
get_parent().add_child(Moves2)
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
_checker()
func _on_Moves_pressed():
piece.rect_position.x = Moves.rect_position.x
piece.rect_position.y = Moves.rect_position.y
Moves.queue_free()
Moves2.queue_free()
Checker.queue_free()
clicked = false
func _on_Moves2_pressed():
piece.rect_position.x = Moves2.rect_position.x
piece.rect_position.y = Moves2.rect_position.y
Moves.queue_free()
Moves2.queue_free()
Checker.queue_free()
clicked = false
func _on_area_entered(area):
check = 2
print("Ta fun")
func _on_TextureButton2_pressed():
piece = $Pieces/TextureButton2
if clicked == false:
_checker()
clicked = true