- [NEW] Convertit a mini v1.0 RC2
This commit is contained in:
@@ -63,7 +63,7 @@ game={
|
||||
|
||||
save=function()
|
||||
local i=1
|
||||
file = io.open(configfolder().."slot"..i..".txt", "w")
|
||||
file = io.open(config.folder().."slot"..i..".txt", "w")
|
||||
if file then
|
||||
io.output(file)
|
||||
io.write("level="..game.level.."\n")
|
||||
@@ -86,7 +86,7 @@ game={
|
||||
|
||||
load=function()
|
||||
local i=1
|
||||
file = io.open(configfolder().."slot"..i..".txt", "r")
|
||||
file = io.open(config.folder().."slot"..i..".txt", "r")
|
||||
local level_name = ""
|
||||
local new_flags={}
|
||||
local new_objects={}
|
||||
@@ -97,7 +97,7 @@ game={
|
||||
local k,v=getkeyval(io.read()) actors.main.x=tonumber(v)
|
||||
local k,v=getkeyval(io.read()) actors.main.y=tonumber(v)
|
||||
local k,v=getkeyval(io.read()) actors.main.o=v
|
||||
io.read() -- ignore "[FLAGS]" line
|
||||
local ignore = io.read() -- ignore "[FLAGS]" line
|
||||
local line = io.read()
|
||||
while line ~= "[OBJECTS]" do
|
||||
local k,v=getkeyval(line)
|
||||
@@ -120,17 +120,17 @@ game={
|
||||
end,
|
||||
|
||||
draw=function()
|
||||
cls(6)
|
||||
camera(game.cam.x, game.cam.y)
|
||||
setsource(tiles)
|
||||
setmap(mapa.surface)
|
||||
map(0,0,0,0,mapa.w, mapa.h)
|
||||
surf.cls(6)
|
||||
view.origin(game.cam.x, game.cam.y)
|
||||
surf.source(tiles)
|
||||
map.set(mapa.surface)
|
||||
map.draw()--map(0,0,0,0,mapa.w, mapa.h)
|
||||
switches.draw();
|
||||
setsource(sprites)
|
||||
if btn(KEY_LSHIFT) then subpal(1,16,8) end
|
||||
actors.draw()
|
||||
subpal()
|
||||
local mx,my=mouse()
|
||||
surf.source(sprites)
|
||||
if key.down(key.LSHIFT) then pal.subpal(1,16,8) end
|
||||
actors.display()
|
||||
pal.subpal()
|
||||
local mx,my=mouse.pos()
|
||||
if actors.under_cursor~="" then
|
||||
if (mx<=80) then
|
||||
text(actors.under_cursor,mx+game.cam.x+4,my+game.cam.y+4,9)
|
||||
@@ -140,13 +140,13 @@ game={
|
||||
end
|
||||
end
|
||||
if mapa.front_layer then
|
||||
setsource(tiles)
|
||||
setmap(mapa.front_layer)
|
||||
map(0,0,0,0,mapa.w, mapa.h)
|
||||
surf.source(tiles)
|
||||
map.set(mapa.front_layer)
|
||||
map.draw() -- map(0,0,0,0,mapa.w, mapa.h)
|
||||
end
|
||||
setmap(mapa.surface)
|
||||
camera(0,0)
|
||||
for i=0,15 do rectfill(20+i*4,0,20+i*4+4,4,i) end
|
||||
map.set(mapa.surface)
|
||||
view.origin(0,0)
|
||||
for i=0,15 do draw.rectf(20+i*4,0,4,4,i) end
|
||||
end,
|
||||
|
||||
update=function()
|
||||
@@ -164,7 +164,7 @@ game={
|
||||
|
||||
game.draw()
|
||||
|
||||
local mx,my=mouse()
|
||||
local mx,my=mouse.pos()
|
||||
text(math.floor((mx+game.cam.x)/8)..","..math.floor((my+game.cam.y)/8),1,19,8)
|
||||
|
||||
text(game.cam.x..","..game.cam.y,1,1,8)
|
||||
@@ -174,37 +174,37 @@ game={
|
||||
text(game.level,1,13,8)
|
||||
|
||||
if not scene.script and hero and not hero.path and hero.dx+hero.dy==0 then
|
||||
if btn(KEY_DOWN) then
|
||||
if key.down(key.DOWN) then
|
||||
hero.path={pos=0,route='d',keys=true}
|
||||
elseif btn(KEY_UP) then
|
||||
elseif key.down(key.UP) then
|
||||
hero.path={pos=0,route='u',keys=true}
|
||||
elseif btn(KEY_LEFT) then
|
||||
elseif key.down(key.LEFT) then
|
||||
hero.path={pos=0,route='l',keys=true}
|
||||
elseif btn(KEY_RIGHT) then
|
||||
elseif key.down(key.RIGHT) then
|
||||
hero.path={pos=0,route='r',keys=true}
|
||||
elseif btnp(KEY_SPACE) then
|
||||
elseif key.press(key.SPACE) then
|
||||
actors.interact(hero.x,hero.y,hero.o)
|
||||
end
|
||||
end
|
||||
if btnp(KEY_ESCAPE) then
|
||||
if key.press(key.ESCAPE) then
|
||||
game.show_menu()
|
||||
end
|
||||
|
||||
if beat() then actors.update() end
|
||||
if sys.beat() then actors.update() end
|
||||
end,
|
||||
|
||||
pause=function()
|
||||
game.paused = true
|
||||
rectfill(9,84, 150, 128,6)
|
||||
rect(9,84, 150, 128,8)
|
||||
rect(8,83, 151, 129,6)
|
||||
draw.rectf(9,84, 141, 44,6)
|
||||
draw.rect(9,84, 141, 44,8)
|
||||
draw.rect(8,83, 143, 46,6)
|
||||
text("OBJECTES:",14,82,8)
|
||||
setsource(objectes)
|
||||
surf.source(objectes)
|
||||
|
||||
local x,y=15,90
|
||||
for i,name in ipairs(objects.list) do
|
||||
local obj = object[name]
|
||||
blit(obj.x,obj.y,16,16,x,y)
|
||||
draw.surf(obj.x,obj.y,16,16,x,y)
|
||||
x=x+19
|
||||
if x==148 then x,y=15,y+19 end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user