This is the first real problem I've run into...
Posted: Sat Jan 09, 2010 8:26 am
So, I'm trying to create a simple tile map. I have this:
It should be 10x10 tiles. (all the image files are 16x16, and the window is set to 160, 160)
When I run this, Love opens, the screen is completely grey for a few seconds, then Love quits. I'm on a Mac, if that helps.
One thousand internets to whoever can help me.
Code: Select all
z = { {0, 0, 1, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 1, 0, 0},
{2, 2, 3, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
{2, 2, 2, 2, 2, 2, 2, 3, 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}
}
grass = love.graphics.newImage("grass.png")
vert = love.graphics.newImage("vertpath.png")
horz = love.graphics.newImage("horzpath.png")
UL = love.graphics.newImage("U/Lpath.png")
love.graphics.setMode( 160, 160, false, true, 0 )
love.graphics.setCaption( "Tiles" )
function love.draw()
for i, v in ipairs(z) do
for j, w in ipairs(z[i]) do
if w==0 then
love.graphics.draw(grass, j*16, i*16)
elseif w==1 then
love.graphics.draw(vert, j*16, i*16)
elseif w==2 then
love.graphics.draw(horz, j*16, i*16)
elseif w==3 then
love.graphics.draw(UL, j*16, i*16)
end
end
end
end
When I run this, Love opens, the screen is completely grey for a few seconds, then Love quits. I'm on a Mac, if that helps.
One thousand internets to whoever can help me.