Code: Select all
BlockSize = 128
Map_Width = 8
Map_Height = 6
sample_map = {
{1,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
}
LoadedMatrix = {}
function DrawBlock(GridPosX,GridPosY, block)
love.graphics.draw(block, GridPosX * BlockSize, GridPosY * BlockSize)
end
function DrawRow(row, map_matrix)
for CurrentColumn = 0, Map_Width, 1 do
BlockData = map_matrix[row][CurrentColumn]
DrawBlock(CurrentColumn, row, love.graphics.newImage("assets/" .. BlockData .. ".png"))
end
end
function DrawMap()
LoadedMatrix = sample_map
for CurrentRow = 0, Map_Height, 1 do
DrawRow(CurrentRow, LoadedMatrix)
end
end
if i change line 30 to the following:
Code: Select all
BlockData = map_matrix[1][1]
can somebody tell me what i'm doing wrong here?