I have a print function that indicates that it is, indeed, loading the level properly. I think the problem is either in the loading code:
Code: Select all
b=0
for a=1,40 do block[a]={} end
for line in love.filesystem.lines(filename) do
b=b+1
for a=1,40 do
block[a][b]=line:sub(a,a)
end
end
end
Code: Select all
for a=1,40 do
for b=1,30 do
if block[a][b]==1 then love.graphics.setColor(100,100,100,255)
elseif block[a][b]==2 then love.graphics.setColor(0,100,0,255) end
if not (block[a][b]==0) then love.graphics.rectangle("fill",(a-1)*16,(b-1)*16,16,16) end
end
end
Edit 2: Figured out the problem. I should have converted the strings to numbers when loading the file.