- [FIX] Arreglada l'interacció amb el cursor

- [NEW] Afegit mode noclip
- [NEW] Acabant la part de La Vella
This commit is contained in:
2025-12-23 13:31:36 +01:00
parent 7767e81c88
commit 1fc69e1958
4 changed files with 44 additions and 9 deletions

View File

@@ -67,8 +67,8 @@ actors={
if v.ox then x = x + v.ox end
if v.oy then y = y + v.oy end
local mousex,mousey=mouse.pos()
local mx = math.floor((mousex+game.cam.x)/8)
local my = math.floor((mousey+game.cam.y)/8)
local mx = math.floor((mousex)/8)
local my = math.floor((mousey)/8)
if (mx==x or mx==x+1) and (my==y or my==y-1) then
actors.under_cursor=v.name
pal.subpal(1,16,8)
@@ -157,27 +157,27 @@ actors={
local step=string.sub(v.path.route,v.path.pos,v.path.pos)
if step=='u' then
v.o='u'
if not actors.check_collision(v.x,v.y,v.o) and not mapa.check_collision(v.x,v.y-1) then
if v.noclip or not actors.check_collision(v.x,v.y,v.o) and not mapa.check_collision(v.x,v.y-1) then
v.y=v.y-1
v.dy=4
needs_sorting=true
end
elseif step=='d' then
v.o='d'
if not actors.check_collision(v.x,v.y,v.o) and not mapa.check_collision(v.x,v.y+1) then
if v.noclip or not actors.check_collision(v.x,v.y,v.o) and not mapa.check_collision(v.x,v.y+1) then
v.y=v.y+1
v.dy=-4
needs_sorting=true
end
elseif step=='l' then
v.o='l'
if not actors.check_collision(v.x,v.y,v.o) and not mapa.check_collision(v.x-1,v.y) then
if v.noclip or not actors.check_collision(v.x,v.y,v.o) and not mapa.check_collision(v.x-1,v.y) then
v.x=v.x-1
v.dx=4
end
elseif step=='r' then
v.o='r'
if not actors.check_collision(v.x,v.y,v.o) and not mapa.check_collision(v.x+1,v.y) then
if v.noclip or not actors.check_collision(v.x,v.y,v.o) and not mapa.check_collision(v.x+1,v.y) then
v.x=v.x+1
v.dx=-4
end

View File

@@ -190,7 +190,8 @@ editor={
map.surf(mapa.surface)
end
local mx,my=mouse.pos()
local tx,ty=(mx+editor.cam.x)>>3,(my+editor.cam.y)>>3
--local tx,ty=(mx+editor.cam.x)>>3,(my+editor.cam.y)>>3
local tx,ty=(mx)>>3,(my)>>3
editor.cx, editor.cy = tx, ty
local rx,ry=tx<<3,ty<<3
draw.rect(rx-1, ry-1, 10, 10, 10)

View File

@@ -31,6 +31,7 @@ game={
end,
startfromeditor=function(s_level, s_x, s_y)
print("Playing level: "..s_level.." at pos "..s_x..","..s_y)
flags={}
objects.list={}
actors.main={name="jailer",x=s_x,y=s_y,o="d",jailmoji="AHDJONAAAAFAACFBBO",level=s_level}
@@ -156,10 +157,10 @@ game={
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)
text(actors.under_cursor,mx+4,my+4,9)
else
local size = #actors.under_cursor
text(actors.under_cursor,mx+game.cam.x-size*4,my+game.cam.y+4,9)
text(actors.under_cursor,mx-size*4,my+4,9)
end
end
if mapa.front_layer then

View File

@@ -36,6 +36,10 @@ levels["vella"]={
actors.add({name="alumne_cua2",x=26,y=26,o="d",gfx={x=0,y=80}})
actors.add({name="alumne_cua3",x=26,y=27,o="d",gfx={x=0,y=64}})
actors.add({name="imbesil",x=27,y=23,o="r",jailmoji="AEFJNJAAAAEBFFIAAB"})
switches.add({x=3,y=34,w=8,h=1,action=
function()
local hero = actors.search(actors.main.name)
@@ -53,11 +57,40 @@ levels["vella"]={
end
end
})
switches.add({x=28,y=24,w=1,h=1,action=
function()
local hero = actors.search(actors.main.name)
--if flags.caixer_visitat==1 then
flags.caixer_visitat=2
scene.start({
function() balloon.show("EH!!!",3,"imbesil",false,{x=5,w=8,h=1}) end,
function() actors.moveto("jailer", 29, 24) end,
function() actors.search("jailer").o='l' scene.cont() end,
function() actors.moveto("imbesil", 27, 24) end,
function() actors.moveto("imbesil", 28, 24) end,
function() balloon.show("DEJA PASO\nMONGOLO!!!",3,"imbesil",false,{x=5,w=8,h=2}) end,
function() actors.moveto("imbesil", 23, 24) end,
function() actors.search("imbesil").o='r' scene.cont() end,
function() balloon.show("PEAZO BOCATROLA ME\nVOY A ZAMPAR CUANDO\nVUELVA DEL BAÑO...",3,"imbesil",true,{x=4,w=12,h=3}) end,
function() actors.moveto("imbesil", 23, 20) end,
function() actors.remove("imbesil") scene.cont() end,
function() wait.start(0.5) end,
function() balloon.show("IMBÈSIL...",3,"jailer",false,{x=5,w=8,h=1}) end,
})
return true
--else
-- return false
--end
end
})
end,
caixer_action=function()
--local hero = actors.search(actors.main.name)
--if hero.o~="d" then return end
flags.caixer_visitat=1
scene.start({
function() balloon.show("BON DIA CARINYET!\nQUE VOLS MENJAR?",15,"caixer",false,{x=4,w=11,h=2}) end,
function() balloon.show("POS OBVIAMENT\nUN BOCADILL DE\nSOBRASADA PATA...",2,"jailer",true,{x=3,w=11,h=3}) end,