mostly working spawn tile function