-- this is for import map to string
function map2string(maptable,typeser)
local sz = ''
for y = 0, map.height do
local row = {}
for x = 0, map.width do
local c = typeser[maptable[x][y]]
c = (c ~= nil) and c or ' '
if not tostring(c):len() == 1 then
error("non-ANSI character on:" .. x .. ',' .. y)
end
row[x] = c
end
sz = sz .. table.concat(row) .. '\n'
end
return sz
end
-- this is for import string to map
local x, y = 0, 0
for l in string.gmatch(love.filesystem.read(file), "(.-)\n") do
for c in string.gmatch(l, ".") do
if map_signloader[c] ~= "nil" and x < map.width+1 then
map_level[x][y] = map_signloader[c]
end
x = x + 1
end
x, y = 0, y + 1
end
Hope you can help me !
function love.load() end
function love.update(dt) end
function love.draw() end
I can see nothing wrong in the new image either. What horizontal shift? Can you maybe take gimp or something, and produce an image of how it should look like, and how it actually looks like?
I think the problem is with counting from 0 to map.width instead of map.width - 1, it thinks the map is one wider than it is so the first block of row 2 is on the end of line 1. After a few lines the map would look very different. This is a total guess though, not a lot of info to go on here.