Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | 9BitStrider |
func spawn_objects():
#Scan tilemap for objects.
for cell in objects.get_used_cells():
var id = objects.get_cellv(cell)
var type = objects.tile_set.tile_get_name(id)
#Get object ID and load into the level.
if type in ['vert_gate', 'horiz_gate']:
var c = load('res://scenes/'+type+'.tscn').instance()
var pos = objects.map_to_world(cell)
c.position = pos + (objects.cell_size / 2)
add_child(c)
Using the above code to load stage object nodes into a stage without placing them manually. It works, but the instanced nodes are drawn ABOVE the player rather than underneath. What do I add to prevent this from happening?