I am making a farming game and spawn an instance of a crop on a TileMap into a container TileMap. I want to be able to interact with the spawned nodes (e.g., harvest). I'm currently trying signals but nothing seems to want to work.
I have a generic plant scene (Plant.tscn, Plant.gd) and scene for the individual crops (e.g., Corn.tscn, Corn.gd) which inherit from plant. I then instance the desired crop on a TileMap (FarmTiles.tscn, FarmTiles.gd) in the container (CropContainer). The script for instancing a crop is in my FarmTiles.gd where I connect the signal.
onready var crop_scene = preload("res://Crops/Strawberry.tscn")
var crop = crop_scene.instance()
var crop_x = loc.x * 16
var crop_y = loc.y * 16
crop.position.x = crop_x
crop.position.y = crop_y
crop.connect("plant_clicked", self, "_on_plant_clicked")
print("plant was clicked")
My plant/crop_scene's signal (Plant.gd)
func _on_Plant_input_event(viewport, event, shape_idx):
My remote scene structure ends up looking like this after planting a couple strawberries: