I'm making a tactical RPG and I want to emit a signal when a unit is pressed and make the map receive that signal.
It's working but I can't get the signal parameters, which I need to identify what unit was pressed.
func _input_event(viewport, event, shape_idx):
if event.type == InputEvent.MOUSE_BUTTON \
and event.button_index == BUTTON_LEFT \
var id = 0
onready var lion = get_node("lion")
lion.connect("select", self, "on_unit_select", [id])
If I don't declare
id I get an
Identifier not found error, and if I declare it I get an error that says that the method
on_unit_select was expecting 1 argument, meaning that the
id = 0 is not getting passed to the function