As the title states, I am trying to instance a scene (pickup) on every one of the specified tiles (pink). Here is my code so far:
onready var pickup_scene = preload("res://Pickup.tscn")
func spawn_pickup(tile_position: Vector2):
var instance = pickup_scene.instance()
instance.position = tile_position
func generate_pickup() -> void:
for tile_position in get_used_cells():
if get_cellv(tile_position) == tile_set.find_tile_by_name("pink"):
this code is located at the very bottom of my tilemap's script. I also have an enum with my tilemap name's and id's at the top which is where my pink tile is named.
When I run this code I get no error, but I also have no pickups spawning on my pink tiles. What am I doing wrong?
Thanks in advance.