Code: Select all
Error
Syntax error: map.lua:1: unexpected symbol near '<eof>'
Traceback
[C]: at 0x7ffb780428f0
[C]: in function 'require'
main.lua:3: in main chunk
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
Code: Select all
map = {}
function drawMap()
love.graphics.setColor(0.5, 0.5, 0.5, 0.4)
love.graphics.rectangle("fill", caseX, caseY, TILESIZE, TILESIZE)
for l=1, map.height do
for c=1, map.width do
local id = map.grid[l][c]
if id ~= 0 then
if id == 1 then
love.graphics.setColor(1, 0, 0, 0.4)
love.graphics.rectangle("fill", (c-1)*TILESIZE, (l-1)*TILESIZE, TILESIZE, TILESIZE)
end
end
if opt.showMap == true then
love.graphics.setColor(0, 0, 0, 1)
love.graphics.print(tostring(id), (c-1)*TILESIZE, (l-1)*TILESIZE)
end
love.graphics.setColor(0, 0, 0, 0.4)
love.graphics.rectangle("line", (c-1)*TILESIZE, (l-1)*TILESIZE, TILESIZE, TILESIZE)
end
end
end
function initMap()
--imgMap = love.graphics.newImage()
map.height = 19
map.width = 25
map.x = 0
map.y = 0
map.x = math.floor(map.x/TILESIZE)*TILESIZE
map.y = math.floor(map.y/TILESIZE)*TILESIZE
map.grid = {}
for l=1, map.height do
map.grid[l] = {}
for c=1, map.width do
map.grid[l][c] = 0
end
end
end
Code: Select all
io.stdout:setvbuf("no")
require 'map'
opt = {}
opt.showMap = false
TILESIZE = 32