Ok. It sounds like I’d have to preset them, correct? Then I’d use the presets and chunk them together randomly.
I tried generating the tilemap with a script today and it gave me the error:
ERROR:GAMESYS: Could not set the tile since the supplied tile was out of range.
Here is what I tried to do.
local tile_size = 124 -- pixels
function init(self)
yy = 0
min,max = 1,5 -- first few blocks in tilesource, the crust of the world
for xx=0,100,1 do -- place ~100 blocks on first row
x = xx * tile_size
if xx == 99 and y < 20 then -- bump down, and reset for next row until 20 tiles
yy = yy + 1
xx = 0
end
y = yy * tile_size
if y > 0 then
min,max = 6,10 -- last few blocks in initial ten out of 100 in tilesource, the mud/underground of the world
end
tile = math.random(min,max) -- call tile, numbered 1-100 in tilesource
tilemap.set_tile("#Terrain_map","ground",x,y,tile) -- place the tile in the tilemap at position x,y
print("MADE BLOCK " .. tile .. " AT: " .. x .. " , " .. y)
end
end
What do you mean by world data? I do not have special terrain yet (Water with physics, etc), if I ever do, so every tile is just for randomized looks and a static ground collision; if that’s what you mean’t by world data.
I watched GamesFromScratch’s tutorial on tilemaps and collisions/physics and learned a lot. I’ll be watching more of his tutorials now ;). I try to do that, and as much as I can (documentation, tutorials, previous topics, etc) without asking for help. I made this topic because I guess I’m trying to use tilemaps in a special way. I suppose I’m misunderstanding the tilemap.set_tile function. I thought it placed tiles, was I incorrect?
Thanks for all your help.