i have a problem with figuring out how to do several things with a 2-dimensional array for isometric display. right now i'm trying to figure out how to expand the 2-dimensional tutorial to add height. i was thinking of having the 2d system hold a string that determines the tile type and its height.
for example:
grid[2][4] = "2,1"
grid[6][5] = "2,2"
with the first number being the terrain type/tile and the second value being its height.
i'm using the draw routine as below:
Code: Select all
function gridDraw()
for x = 1,gridSizex do
for y = 1,gridSizey do
local tempx = grid_x + ((y-x) * (blockWidth / 2))
local tempy = grid_y + ((x+y) * (blockFace)) - (blockFace * (gridSizey / 2))
if grid[x][y] == 1 then
love.graphics.draw(tilesetImage, grass, tempx, tempy)
elseif grid[x][y] == 2 then
love.graphics.draw(tilesetImage, dirt, tempx, tempy)
end
end
end
end
is there a better way to store the map data; and how do i change the function to draw height?
thanks!
EDIT:
i think what i'd like to do is that grid[x][y] value will store a string = "2,1" with the top tile determining properties of tiles beneath. like if it's topped by a grass tile all underneath tiles will automatically be dirt and if a stone tile all subsequent tiles will also be stone.