WorldSize = 100
Width = 0
Height = 0
DirtLayerHeight = 10
Width = WorldSize / 2
Height = WorldSize / 2
print(Width, Height)
function TerrainGeneration()
local terrain = {}
for x = 1, Width do
terrain[x] = {}
for y = 1, Height do
if Height - x < DirtLayerHeight then
terrain[x][y] = "dirt"
else
terrain[x][y] = "stone"
end
print("Tile at (" .. x .. ", " .. y .. "): " .. terrain[x][y])
end
end
end
TerrainGeneration()
So I need to replace both “dirt” and “stone”, but me being newer to lua and defold I don’t understand how to fetch these from a tilemap, my initial thoughts are to make 2 tilemaps and have them both apart of the GO. But I’m not understanding how the structuring works at all . I’ve looked over the tilemap documentation and that doesn’t seem to help me either mainly my lack of understanding does anyone know a good tutorial resource for implementing tilemaps into scripts?
To note: this is just a basic setup I will later use noise to create nil or air tiles for caves and frequencies using a noise generator in 2d much like perlin and pulling a specified value