[never mind] MY LEVEL EDITOR NOT WORKING!!!!11!!
Posted: Sun Aug 07, 2011 11:20 pm
On the first screen, you can enter a filename for the level. If it doesn't exist, it starts you off with a blank canvas, and you can click on squares in the grid to fill them in (and right click to delete them). When you close the program, it saves the level. This is all working fine. However, it's supposed to load the file if you specify one that already exists. That isn't working.
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:
or the drawing code:
Edit: Crud I forgot the .love file.
Edit 2: Figured out the problem. I should have converted the strings to numbers when loading the file.
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.