- Canvis per a adaptar el codi a mini v0.9.95
This commit is contained in:
@@ -53,22 +53,22 @@ actors={
|
||||
local x,y = v.x, v.y
|
||||
if v.ox then x = x + v.ox end
|
||||
if v.oy then y = y + v.oy end
|
||||
|
||||
local mx = math.floor((mousex()+game.cam.x)/8)
|
||||
local my = math.floor((mousey()+game.cam.y)/8)
|
||||
local mousex,mousey=mouse()
|
||||
local mx = math.floor((mousex+game.cam.x)/8)
|
||||
local my = math.floor((mousey+game.cam.y)/8)
|
||||
if (mx==x or mx==x+1) and (my==y or my==y-1) then
|
||||
actors.under_cursor=v.name
|
||||
subpal(1,16,8)
|
||||
end
|
||||
|
||||
if v.o=='u' then
|
||||
sspr(v.gfx.x+frame,v.gfx.y+16,16,16,x*8+v.dx*2,y*8-12+v.dy*2,16,16,v.dy>1)
|
||||
blit(v.gfx.x+frame,v.gfx.y+16,16,16,x*8+v.dx*2,y*8-12+v.dy*2,16,16,v.dy>1)
|
||||
elseif v.o=='d' then
|
||||
sspr(v.gfx.x+frame,v.gfx.y,16,16,x*8+v.dx*2,y*8-12+v.dy*2,16,16,-v.dy>2)
|
||||
blit(v.gfx.x+frame,v.gfx.y,16,16,x*8+v.dx*2,y*8-12+v.dy*2,16,16,-v.dy>2)
|
||||
elseif v.o=='l' then
|
||||
sspr(v.gfx.x+frame,v.gfx.y+32,16,16,x*8+v.dx*2,y*8-12+v.dy*2,16,16)
|
||||
blit(v.gfx.x+frame,v.gfx.y+32,16,16,x*8+v.dx*2,y*8-12+v.dy*2,16,16)
|
||||
elseif v.o=='r' then
|
||||
sspr(v.gfx.x+frame,v.gfx.y+32,16,16,x*8+v.dx*2,y*8-12+v.dy*2,16,16,true)
|
||||
blit(v.gfx.x+frame,v.gfx.y+32,16,16,x*8+v.dx*2,y*8-12+v.dy*2,16,16,true)
|
||||
end
|
||||
|
||||
if not btn(KEY_LSHIFT) then subpal() end
|
||||
|
||||
@@ -110,10 +110,10 @@ balloon={
|
||||
if balloon.pos<0 then
|
||||
if balloon.obj then
|
||||
setsource(objectes)
|
||||
sspr(balloon.obj.x,balloon.obj.y,16,16,balloon.rect.x+balloon.rect.w-28,balloon.rect.y+10)
|
||||
blit(balloon.obj.x,balloon.obj.y,16,16,balloon.rect.x+balloon.rect.w-28,balloon.rect.y+10)
|
||||
end
|
||||
local col=8
|
||||
if flr(time()*4)%2==0 then col=10 end
|
||||
if math.floor(time()*4)%2==0 then col=10 end
|
||||
local x,y=balloon.rect.x+balloon.rect.w-8, balloon.rect.y+balloon.rect.h-6
|
||||
line(x,y,x+4,y,col)
|
||||
line(x+1,y+1,x+3,y+1,col)
|
||||
|
||||
@@ -166,8 +166,8 @@ editor={
|
||||
else
|
||||
setmap(mapa.surface)
|
||||
end
|
||||
local mx,my=mousex()+editor.cam.x,mousey()+editor.cam.y
|
||||
local tx,ty=mx>>3,my>>3
|
||||
local mx,my=mouse()
|
||||
local tx,ty=(mx+editor.cam.x)>>3,(my+editor.cam.y)>>3
|
||||
local rx,ry=tx<<3,ty<<3
|
||||
rect(rx-1, ry-1, rx+8, ry+8, 10)
|
||||
if editor.selection then
|
||||
@@ -243,9 +243,9 @@ editor={
|
||||
|
||||
update_tileset=function()
|
||||
cls()
|
||||
sspr(0,0,128,128,0,0)
|
||||
blit(0,0,128,128,0,0)
|
||||
|
||||
local mx,my=mousex(),mousey()
|
||||
local mx,my=mouse()
|
||||
local tx,ty=mx>>3,my>>3
|
||||
local rx,ry=tx<<3,ty<<3
|
||||
rect(rx-1, ry-1, rx+8, ry+8, 10)
|
||||
|
||||
@@ -9,7 +9,7 @@ fade={
|
||||
|
||||
init = function()
|
||||
for i=1,16 do
|
||||
local r,g,b=getcolor(i)
|
||||
local r,g,b=palcolor(i)
|
||||
fade.pal[i]={r,g,b}
|
||||
end
|
||||
end,
|
||||
@@ -42,9 +42,9 @@ fade={
|
||||
for i=1,16 do
|
||||
local v=fade.getstep(i,fade.step)
|
||||
if v==0 then
|
||||
setcolor(i,0,0,0)
|
||||
palcolor(i,0,0,0)
|
||||
else
|
||||
setcolor(i,fade.pal[v][1],fade.pal[v][2],fade.pal[v][3])
|
||||
palcolor(i,fade.pal[v][1],fade.pal[v][2],fade.pal[v][3])
|
||||
end
|
||||
end
|
||||
fade.step=fade.step+1
|
||||
@@ -66,7 +66,7 @@ fade={
|
||||
fade.old_update=update
|
||||
update=fade.update_fadein
|
||||
fade.step=6
|
||||
for i=1,16 do setcolor(i,0,0,0) end
|
||||
for i=1,16 do palcolor(i,0,0,0) end
|
||||
end,
|
||||
|
||||
update_fadein=function()
|
||||
@@ -76,9 +76,9 @@ fade={
|
||||
for i=1,16 do
|
||||
local v=fade.getstep(i,fade.step)
|
||||
if v==0 then
|
||||
setcolor(i,0,0,0)
|
||||
palcolor(i,0,0,0)
|
||||
else
|
||||
setcolor(i,fade.pal[v][1],fade.pal[v][2],fade.pal[v][3])
|
||||
palcolor(i,fade.pal[v][1],fade.pal[v][2],fade.pal[v][3])
|
||||
end
|
||||
end
|
||||
fade.step=fade.step-1
|
||||
|
||||
@@ -125,12 +125,13 @@ game={
|
||||
if btn(KEY_LSHIFT) then subpal(1,16,8) end
|
||||
actors.draw()
|
||||
subpal()
|
||||
local mx,my=mouse()
|
||||
if actors.under_cursor~="" then
|
||||
if (mousex()<=80) then
|
||||
text(actors.under_cursor,mousex()+game.cam.x+4,mousey()+game.cam.y+4,9)
|
||||
if (mx<=80) then
|
||||
text(actors.under_cursor,mx+game.cam.x+4,my+game.cam.y+4,9)
|
||||
else
|
||||
local size = #actors.under_cursor
|
||||
text(actors.under_cursor,mousex()+game.cam.x-size*4,mousey()+game.cam.y+4,9)
|
||||
text(actors.under_cursor,mx+game.cam.x-size*4,my+game.cam.y+4,9)
|
||||
end
|
||||
end
|
||||
if mapa.front_layer then
|
||||
@@ -158,9 +159,8 @@ game={
|
||||
|
||||
game.draw()
|
||||
|
||||
local mx = math.floor((mousex()+game.cam.x)/8)
|
||||
local my = math.floor((mousey()+game.cam.y)/8)
|
||||
text(mx..","..my,1,19,8)
|
||||
local mx,my=mouse()
|
||||
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)
|
||||
if hero then
|
||||
@@ -199,7 +199,7 @@ game={
|
||||
local x,y=15,90
|
||||
for i,name in ipairs(objects.list) do
|
||||
local obj = object[name]
|
||||
sspr(obj.x,obj.y,16,16,x,y)
|
||||
blit(obj.x,obj.y,16,16,x,y)
|
||||
x=x+19
|
||||
if x==148 then x,y=15,y+19 end
|
||||
end
|
||||
|
||||
@@ -29,9 +29,9 @@ menu = {
|
||||
if menu.selected==0 then menu.selected=#menu.options end
|
||||
if menu.selected>#menu.options then menu.selected=1 end
|
||||
|
||||
local mx,my=mousex(),mousey()
|
||||
local mx,my=mouse()
|
||||
if mx>=20 and mx<=140 and my>=28 and my<=(28+#menu.options*10) then
|
||||
menu.selected=min(1+flr((my-28)/10),#menu.options)
|
||||
menu.selected=math.min(1+math.floor((my-28)/10),#menu.options)
|
||||
if mbtnp(1) then
|
||||
update=menu.old_update
|
||||
menu.options[menu.selected][2]()
|
||||
|
||||
@@ -21,7 +21,7 @@ textbox={
|
||||
rect(40,70, 120, 80,8)
|
||||
if textbox.value then
|
||||
prnt(textbox.value,43,73)
|
||||
if (flr(time()*4)%2)==0 then
|
||||
if (math.floor(time()*4)%2)==0 then
|
||||
prnt("_",43+#textbox.value*4,73)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user