Code: Select all
for x = 1, 10 do
for y = 1, 10 do
if map[x][y] == 1 then love.graphics.draw( tile[1], ( x * tile_w ), ( y * tile_h )) end
end
end
Code: Select all
for x = 1, 10 do
for y = 1, 10 do
if map[x][y] == 1 then love.graphics.draw( tile[1], ( x * tile_w ), ( y * tile_h )) end
end
end
Code: Select all
function DRAW_MAP()
if GAME_INPLAY == 1 then
if MAPS[1].chosen == 1 then
for x = 1, MAP_w do
for y = 1, MAP_h do
if MAP_LEVEL[1][x][y] == 1 then
love.graphics.draw(IMG_BLOCK_HOLDER, (x * tilewidth), (y * tileheight))
end
end
end
end
end
end
Code: Select all
{
{ 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1, 1 },
}
Yeah, that almost always confuses me when changing from world coordinates to matrix coordinates. Matrix goes row, column (with the row being y, and the column being x).IMP1 wrote:In what format is the map?
I ask because when I have my maps, they're in the formIn which case the loop needs to be y and then x. And doing it the other way round (unless the map is square) will result in error (and even then it'll draw it rotated).Code: Select all
{ { 1, 1, 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1, 1, 1 }, }
Users browsing this forum: Bing [Bot], Google [Bot] and 10 guests