- [NEW] Convertit a mini v1.0 RC2

This commit is contained in:
2025-05-31 14:29:29 +02:00
parent 28f9851f00
commit c2f7b470bf
14 changed files with 241 additions and 244 deletions

View File

@@ -2,17 +2,17 @@ mapa={
name=nil,
w=128,
h=128,
surface=nil,
surface=-1,
new = function(w,h)
mapa.name=nil
mapa.w,mapa.h=w,h
if mapa.surface~=nil then freesurf(mapa.surface) end
mapa.surface=newsurf(w,h)
setmap(mapa.surface)
if mapa.surface~=-1 then surf.free(mapa.surface) end
mapa.surface=surf.new(w,h)
map.set(mapa.surface)
for y=0,127 do
for x=0,127 do
mset(x,y,0)
map.tile(x,y,0)
end
end
mapa.front_layer=nil
@@ -32,25 +32,25 @@ mapa={
local line = io.read()
local x=0
for m in string.gmatch(line, "%d+") do
mset(x,y,m)
map.tile(x,y,m)
x=x+1
end
end
if num_layers==2 then
mapa.front_layer=newsurf(mapa.w,mapa.h)
setmap(mapa.front_layer)
mapa.front_layer=surf.new(mapa.w,mapa.h)
map.set(mapa.front_layer)
for y=0,mapa.h-1 do
local line = io.read()
local x=0
for m in string.gmatch(line, "%d+") do
mset(x,y,m)
map.tile(x,y,m)
x=x+1
end
end
end
setmap(mapa.surface)
map.set(mapa.surface)
io.close(file)
end
end,
@@ -63,18 +63,18 @@ mapa={
io.write(mapa.w.."\n")
io.write(mapa.h.."\n")
if mapa.front_layer then io.write("2\n") else io.write("1\n") end
setmap(mapa.surface)
map.set(mapa.surface)
for y=0,mapa.h-1 do
for x=0,mapa.w-1 do
io.write(mget(x,y)..",")
io.write(map.tile(x,y)..",")
end
io.write("\n")
end
if mapa.front_layer then
setmap(mapa.front_layer)
map.set(mapa.front_layer)
for y=0,mapa.h-1 do
for x=0,mapa.w-1 do
io.write(mget(x,y)..",")
io.write(map.tile(x,y)..",")
end
io.write("\n")
end
@@ -84,6 +84,6 @@ mapa={
end,
check_collision=function(x,y)
return mget(x,y) >= 32 or mget(x+1,y) >= 32
return map.tile(x,y) >= 32 or map.tile(x+1,y) >= 32
end
}