This would be the part of the code that gives me an error.
for y in range(rows):
var row = []
for x in range(columns):
var label = Button.new()
row.append(label)
self.add_child(label)
label.group = "letters" # Asignar el grupo "letters" a los botones
label.connect("pressed", self, "_on_LetterPressed", [x, y]) # Conectar la señal de presionado
grid.append(row)
In Godot 3 the connect works fine but the label.groups doesn't work, how can I do this in Godot 4?
How to upgrade
connect
from Godot 3 to Godot 4Let us start with the simple case. If in Godot 3 you connect like this:
Godot 3
You can do the same in Godot 4, by making a
Callable
:Godot 4
By the way, Godot will make a
Callable
for us like this:Godot 4
Furthermore, you can use the
Signal
like this:Godot 4
With extra arguments
However, in your case you have extra arguments:
Godot 3
What we are going to do in Godot 4 is bind them to the
Callable
like this:Godot 4
Or like this:
Godot 4
Or like this:
Godot 4