Hi all!
Is it possible to connect a signal and a method that requires arguments?
More specifically, in the below code (attached to my grid map) I add an enemy to a grid and connect it's death signal to a method in that grid map
func place_enemies(pos:Vector2):
var new_enemy = enemy_scene.instance()
new_enemy.position = (map_to_world(pos) + tile_offset)
sorter.add_child(new_enemy)
set_cell_content(new_enemy.position, ENEMY)
new_enemy.connect("death", self, "vacate_cell")
func vacate_cell(pos:Vector2):
var grid_pos = world_to_map(pos)
grid[grid_pos.x][grid_pos.y] = null
Pretty straightforward. I just want to make sure that the data the grid was holding on to gets removed when the enemy dies.
However, the method requires a position to know which cell to clear of data and I don't know how to work that into the whole connect thing.
Can this be resolved with a signal? Or am I going about this the wrong way entirely?
Thanks!