Instanced sprites not showing up

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Andrew James Miller

I am fairly new to Godot and I am having trouble figuring out why the following will not work as I expect it to. It is supposed to draw a pattern of tiles similar to the following:

I have a Tile class with a pair of coordinates and a texture. I am creating an array of Tiles, then giving each Tile’s texture and position to a new instance of a scene containing a single Sprite. There are no errors, but the Sprites are not showing up. Why?

extends Panel

var tiles = [];
var ntiles = 27;
var tsize = 24;

var orange = preload("res://orange.png")
var blue = preload("res://blue.png")

var tile = preload("res://tile.tscn")
	
class Tile:
	
	var ntiles = 27;
	var tsize = 24;
	
	var x
	var y
	var c
	
	func _init(x, y, c):
		self.x = x*tsize
		self.y = y*tsize
		self.c = c
	
func _ready():
	
	for i in range(ntiles/2+1):
		for j in range(i):
			
			tiles.append(Tile.new(ntiles/2+j, i, blue))
			tiles.append(Tile.new(ntiles/2-j, i, blue))
			
			tiles.append(Tile.new(ntiles/2+j, -i+ntiles, orange))
			tiles.append(Tile.new(ntiles/2-j, -i+ntiles, orange))
		
	for t in tiles:
		var s = tile.instance()
		s.position = (Vector2(t.x, t.y))
		s.set_texture(t.c)

func _process(delta):
	pass
:bust_in_silhouette: Reply From: volzhs

You did not add it to scene.
You need to do add_child(s) at proper line.