[FIX] Col·lisió en el peu

[FIX] Canviada dialeg.run a dialeg.show
[NEW] Afegit dialeg.add
This commit is contained in:
2026-05-10 16:11:32 +02:00
parent 275122fd40
commit fbba9a6987
9 changed files with 87 additions and 68 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ function abad_init()
respawning=0, respawning=0,
hab=10, hab=10,
vides=3, vides=3,
energia=6, energia=3,
max_energia=6, max_energia=6,
falling=0, falling=0,
step=0, step=0,
+18 -3
View File
@@ -47,11 +47,23 @@ function dialeg.draw_globo(x, y, w, h, flip, text)
font.current(font_curr) font.current(font_curr)
end end
function dialeg.run(_x, _y, _w, flip, text, always_visible) function dialeg.add(_actor, _text, _time)
local w = math.floor(4.6*#text) local _w = math.floor(4.6*#_text)
local h = 20 table.insert(
dialeg.list,
{ actor= _actor,
text = _text,
time = _time,
w = _w,
h = 20,
}
)
end
function dialeg.show(_x, _y, _w, flip, text, always_visible)
local x = 0 local x = 0
local y = 0 local y = 0
y = _y-20 y = _y-20
if flip then if flip then
x = _x-w x = _x-w
@@ -63,6 +75,9 @@ function dialeg.run(_x, _y, _w, flip, text, always_visible)
if x<0 then x=0 end if x<0 then x=0 end
if y<0 then y=0 end if y<0 then y=0 end
end end
local w = math.floor(4.6*#text)
local h = 20
dialeg.draw_globo(x, y, w, h, flip, text) dialeg.draw_globo(x, y, w, h, flip, text)
end end
+1
View File
@@ -385,6 +385,7 @@ function elalien.stage1_ending_init()
elalien.hab = 9 elalien.hab = 9
elalien.x = 0 elalien.x = 0
elalien.y = 3 elalien.y = 3
elalien.flip=true
local world_x, world_y = coords.room_to_world(elalien.hab,elalien.x,elalien.y) local world_x, world_y = coords.room_to_world(elalien.hab,elalien.x,elalien.y)
elalien.x=world_x elalien.x=world_x
elalien.y=world_y elalien.y=world_y
+1 -1
View File
@@ -49,7 +49,7 @@ function pattern:noop()
end end
function pattern:draw() function pattern:draw()
-- if true then return end if true then return end
local scr_x = 0 local scr_x = 0
local scr_y = 0 local scr_y = 0
local target = self:target() local target = self:target()
+4 -1
View File
@@ -7,7 +7,7 @@ ch = arcade_config.character_height
peu_gif_col = 7 peu_gif_col = 7
peu_gif_row = 2 peu_gif_row = 2
peu={name="peu",hab=5,x=6,y=3,w=32,h=32,bb={x=0,y=12,w=32,h=20}} peu={name="peu",hab=5,x=6,y=3,w=32,h=32,bb={x=4,y=12,w=26,h=20}}
function peu.init() function peu.init()
-- local habs={{18,8},{16,2},{16,7},{15,5},{27,1},{27,10},{29,2},{38,8},{69,2},{79,3}} -- local habs={{18,8},{16,2},{16,7},{15,5},{27,1},{27,10},{29,2},{38,8},{69,2},{79,3}}
@@ -35,6 +35,9 @@ function peu.draw()
local y = peu_gif_row*ch local y = peu_gif_row*ch
local scr_x, scr_y = viewp:screen_coords( peu.x, peu.y ) local scr_x, scr_y = viewp:screen_coords( peu.x, peu.y )
draw.surf(x,y,peu.w,peu.h,scr_x,scr_y,peu.w,peu.h) draw.surf(x,y,peu.w,peu.h,scr_x,scr_y,peu.w,peu.h)
-- bb debug
draw.rect(scr_x+peu.bb.x,scr_y+peu.bb.y,peu.bb.w,peu.bb.h,3)
end end
function peu.update() function peu.update()
+10 -10
View File
@@ -256,16 +256,16 @@ function premiere.healer_update()
local hab, tx, ty = coords.world_to_tile(premiere.x, premiere.y) local hab, tx, ty = coords.world_to_tile(premiere.x, premiere.y)
if hab == 55 and tx==0 and ty==3 and premiere.health_wait==100 then if hab == 55 and tx==0 and ty==3 and premiere.health_wait==100 then
-- 55 (0,3) -- 55 (0,3)
local _text = "Tenne! Io t'achudo. Figo!"; dialeg.add(premiere, "Tenne! Io t'achudo. Figo!", 200)
table.insert( -- table.insert(
dialeg.list, -- dialeg.list,
{ actor=premiere, -- { actor=premiere,
text=_text, -- text=_text,
time=200, -- time=200,
w = math.floor(4.6*#_text), -- w = math.floor(4.6*#_text),
h = 20, -- h = 20,
} -- }
) -- )
premiere.health_wait = premiere.health_wait - 1 premiere.health_wait = premiere.health_wait - 1
table.insert( actors, health_potion.new( table.insert( actors, health_potion.new(
premiere.hab, premiere.hab,
+3 -3
View File
@@ -7,7 +7,7 @@ stage1_ending ={
} }
function stage1_ending.update_scene(self) function stage1_ending.update_scene(self)
print("UPDATING "..self.time) -- print("UPDATING "..self.time)
if self.time==0 then if self.time==0 then
start_scene(scenes.stage1_ending, nil, false) start_scene(scenes.stage1_ending, nil, false)
@@ -64,12 +64,12 @@ function stage1_ending.update_scene(self)
-- dialegs draw -- dialegs draw
if self.time>201 and self.time<300 then if self.time>201 and self.time<300 then
-- bocadillo quinta escena (1) -- bocadillo quinta escena (1)
dialeg.run(premiere.x, premiere.y, dialeg.show(premiere.x, premiere.y,
premiere.w, false, premiere.w, false,
"Volare uoh oh...", true) "Volare uoh oh...", true)
elseif self.time>=300 and self.time<400 then elseif self.time>=300 and self.time<400 then
-- bocadillo quinta escena (2) -- bocadillo quinta escena (2)
dialeg.run(premiere.x, premiere.y, dialeg.show(premiere.x, premiere.y,
premiere.w, false, premiere.w, false,
"Cantare uoh oh oh oh...", true) "Cantare uoh oh oh oh...", true)
end end
+1 -1
View File
@@ -64,7 +64,7 @@ function trigger:draw()
end end
-- debug rect -- debug rect
draw.rect(scr_x,scr_y,self.bb.w,self.bb.h,3) -- draw.rect(scr_x,scr_y,self.bb.w,self.bb.h,3)
end end
--function trigger:do_touched() --function trigger:do_touched()
+48 -48
View File
@@ -76,54 +76,54 @@ function trigger_ev:premiere_healer_init()
trigger_event.disable(self.name) trigger_event.disable(self.name)
end end
function trigger_ev:premiere_healer_update() -- function trigger_ev:premiere_healer_update()
premiere.wait=premiere.wait+1 -- premiere.wait=premiere.wait+1
--
-- Esperar mentres dona la vida -- -- Esperar mentres dona la vida
if premiere.health_wait>0 and premiere.health_wait<100 then -- if premiere.health_wait>0 and premiere.health_wait<100 then
premiere.health_wait = premiere.health_wait - 1 -- premiere.health_wait = premiere.health_wait - 1
else -- else
premiere.x = premiere.x+1 -- premiere.x = premiere.x+1
if premiere.wait>=6 then -- if premiere.wait>=6 then
premiere.wait = 0 -- premiere.wait = 0
premiere.step=(premiere.step+1)%4 -- premiere.step=(premiere.step+1)%4
premiere.frame=premiere.anim[premiere.step+1] -- premiere.frame=premiere.anim[premiere.step+1]
end -- end
end -- end
--
-- Lloc de pausa -- -- Lloc de pausa
local hab, tx, ty = coords.world_to_tile(premiere.x, premiere.y) -- local hab, tx, ty = coords.world_to_tile(premiere.x, premiere.y)
if hab == 55 and tx==0 and ty==3 and premiere.health_wait==100 then -- if hab == 55 and tx==0 and ty==3 and premiere.health_wait==100 then
-- 55 (0,3) -- -- 55 (0,3)
local _text = "Tenne! Io t'achudo. Figo!"; -- local _text = "Tenne! Io t'achudo. Figo!";
table.insert( -- table.insert(
dialeg.list, -- dialeg.list,
{ actor=premiere, -- { actor=premiere,
text=_text, -- text=_text,
time=200, -- time=200,
w = math.floor(4.6*#_text), -- w = math.floor(4.6*#_text),
h = 20, -- h = 20,
} -- }
) -- )
premiere.health_wait = premiere.health_wait - 1 -- premiere.health_wait = premiere.health_wait - 1
table.insert( actors, health_potion.new( -- table.insert( actors, health_potion.new(
premiere.hab, -- premiere.hab,
premiere.x+premiere.bb.x+premiere.bb.w, -- premiere.x+premiere.bb.x+premiere.bb.w,
premiere.y+premiere.bb.y+premiere.bb.h/3, -- premiere.y+premiere.bb.y+premiere.bb.h/3,
1, 24, 3) -- 1, 24, 3)
) -- )
-- health_potion.init(premiere.hab, -- -- health_potion.init(premiere.hab,
-- premiere.x+premiere.bb.x+premiere.bb.w, -- -- premiere.x+premiere.bb.x+premiere.bb.w,
-- premiere.y+premiere.bb.y+premiere.bb.h/3, -- -- premiere.y+premiere.bb.y+premiere.bb.h/3,
-- 1, 24, 2) -- -- 1, 24, 2)
elseif hab >= 56 then -- elseif hab >= 56 then
-- Restaurar a Premiere -- -- Restaurar a Premiere
premiere.hab = premiere.from_hab -- premiere.hab = premiere.from_hab
premiere.x = premiere.from_x -- premiere.x = premiere.from_x
premiere.y = premiere.from_y -- premiere.y = premiere.from_y
premiere.update = premiere.from_update -- premiere.update = premiere.from_update
end -- end
end -- end
-- DIALEG GENERAL -- DIALEG GENERAL
function trigger_ev:dialeg_trigger () function trigger_ev:dialeg_trigger ()