Tile map drawing (Drawable expected, got nil)
Posted: Wed Apr 04, 2018 7:18 pm
This is map drawing code
and there is the other tile related stuff inside love.load()
I'm just sitting here very confused because I've followed the tutorial on the wiki almost to a tee and it simply won't draw the map.
Code: Select all
function draw_map()
for y = 1, map_display_h do
for x = 1, map_display_w do
love.graphics.draw(tile[map[y+map_y][x+map_x]],0,0)
--love.graphics.draw(tile[map[2][2]],0,0)
--love.graphics.draw(tile[level[y][x]], x*50, y*50)
--love.graphics.draw(tiles, x*50, y*50)
--love.graphics.draw(tile[map[y+map_y][x+map_x]],(x*tile_w)+map_offset_x,(y*tile_h)+map_offset_y)
end
end
end
Code: Select all
tile = {}
for i = 0, 2 do
tile[i] = love.graphics.newImage("tile" ..i.. ".png")
end
map_display_w = 25
map_display_h = 9
map_x = 0
map_y = 0
map={"0000000000000000000000000",
"0111111111111111111111110",
"0111111111111111111111110",
"0111111111111111111111110",
"0111111111111111111111110",
"0111111111111111111111110",
"0111111111211111211111110",
"0111211111111111211112110",
"0000000000000000000000000",
}