[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,
hab=10,
vides=3,
energia=6,
energia=3,
max_energia=6,
falling=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)
end
function dialeg.run(_x, _y, _w, flip, text, always_visible)
local w = math.floor(4.6*#text)
local h = 20
function dialeg.add(_actor, _text, _time)
local _w = math.floor(4.6*#_text)
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 y = 0
y = _y-20
if flip then
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 y<0 then y=0 end
end
local w = math.floor(4.6*#text)
local h = 20
dialeg.draw_globo(x, y, w, h, flip, text)
end
+1
View File
@@ -385,6 +385,7 @@ function elalien.stage1_ending_init()
elalien.hab = 9
elalien.x = 0
elalien.y = 3
elalien.flip=true
local world_x, world_y = coords.room_to_world(elalien.hab,elalien.x,elalien.y)
elalien.x=world_x
elalien.y=world_y
+1 -1
View File
@@ -49,7 +49,7 @@ function pattern:noop()
end
function pattern:draw()
-- if true then return end
if true then return end
local scr_x = 0
local scr_y = 0
local target = self:target()
+4 -1
View File
@@ -7,7 +7,7 @@ ch = arcade_config.character_height
peu_gif_col = 7
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()
-- 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 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)
-- bb debug
draw.rect(scr_x+peu.bb.x,scr_y+peu.bb.y,peu.bb.w,peu.bb.h,3)
end
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)
if hab == 55 and tx==0 and ty==3 and premiere.health_wait==100 then
-- 55 (0,3)
local _text = "Tenne! Io t'achudo. Figo!";
table.insert(
dialeg.list,
{ actor=premiere,
text=_text,
time=200,
w = math.floor(4.6*#_text),
h = 20,
}
)
dialeg.add(premiere, "Tenne! Io t'achudo. Figo!", 200)
-- table.insert(
-- dialeg.list,
-- { actor=premiere,
-- text=_text,
-- time=200,
-- w = math.floor(4.6*#_text),
-- h = 20,
-- }
-- )
premiere.health_wait = premiere.health_wait - 1
table.insert( actors, health_potion.new(
premiere.hab,
+3 -3
View File
@@ -7,7 +7,7 @@ stage1_ending ={
}
function stage1_ending.update_scene(self)
print("UPDATING "..self.time)
-- print("UPDATING "..self.time)
if self.time==0 then
start_scene(scenes.stage1_ending, nil, false)
@@ -64,12 +64,12 @@ function stage1_ending.update_scene(self)
-- dialegs draw
if self.time>201 and self.time<300 then
-- bocadillo quinta escena (1)
dialeg.run(premiere.x, premiere.y,
dialeg.show(premiere.x, premiere.y,
premiere.w, false,
"Volare uoh oh...", true)
elseif self.time>=300 and self.time<400 then
-- bocadillo quinta escena (2)
dialeg.run(premiere.x, premiere.y,
dialeg.show(premiere.x, premiere.y,
premiere.w, false,
"Cantare uoh oh oh oh...", true)
end
+1 -1
View File
@@ -64,7 +64,7 @@ function trigger:draw()
end
-- 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
--function trigger:do_touched()
+48 -48
View File
@@ -76,54 +76,54 @@ function trigger_ev:premiere_healer_init()
trigger_event.disable(self.name)
end
function trigger_ev:premiere_healer_update()
premiere.wait=premiere.wait+1
-- Esperar mentres dona la vida
if premiere.health_wait>0 and premiere.health_wait<100 then
premiere.health_wait = premiere.health_wait - 1
else
premiere.x = premiere.x+1
if premiere.wait>=6 then
premiere.wait = 0
premiere.step=(premiere.step+1)%4
premiere.frame=premiere.anim[premiere.step+1]
end
end
-- Lloc de pausa
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
-- 55 (0,3)
local _text = "Tenne! Io t'achudo. Figo!";
table.insert(
dialeg.list,
{ actor=premiere,
text=_text,
time=200,
w = math.floor(4.6*#_text),
h = 20,
}
)
premiere.health_wait = premiere.health_wait - 1
table.insert( actors, health_potion.new(
premiere.hab,
premiere.x+premiere.bb.x+premiere.bb.w,
premiere.y+premiere.bb.y+premiere.bb.h/3,
1, 24, 3)
)
-- health_potion.init(premiere.hab,
-- premiere.x+premiere.bb.x+premiere.bb.w,
-- premiere.y+premiere.bb.y+premiere.bb.h/3,
-- 1, 24, 2)
elseif hab >= 56 then
-- Restaurar a Premiere
premiere.hab = premiere.from_hab
premiere.x = premiere.from_x
premiere.y = premiere.from_y
premiere.update = premiere.from_update
end
end
-- function trigger_ev:premiere_healer_update()
-- premiere.wait=premiere.wait+1
--
-- -- Esperar mentres dona la vida
-- if premiere.health_wait>0 and premiere.health_wait<100 then
-- premiere.health_wait = premiere.health_wait - 1
-- else
-- premiere.x = premiere.x+1
-- if premiere.wait>=6 then
-- premiere.wait = 0
-- premiere.step=(premiere.step+1)%4
-- premiere.frame=premiere.anim[premiere.step+1]
-- end
-- end
--
-- -- Lloc de pausa
-- 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
-- -- 55 (0,3)
-- local _text = "Tenne! Io t'achudo. Figo!";
-- table.insert(
-- dialeg.list,
-- { actor=premiere,
-- text=_text,
-- time=200,
-- w = math.floor(4.6*#_text),
-- h = 20,
-- }
-- )
-- premiere.health_wait = premiere.health_wait - 1
-- table.insert( actors, health_potion.new(
-- premiere.hab,
-- premiere.x+premiere.bb.x+premiere.bb.w,
-- premiere.y+premiere.bb.y+premiere.bb.h/3,
-- 1, 24, 3)
-- )
-- -- health_potion.init(premiere.hab,
-- -- premiere.x+premiere.bb.x+premiere.bb.w,
-- -- premiere.y+premiere.bb.y+premiere.bb.h/3,
-- -- 1, 24, 2)
-- elseif hab >= 56 then
-- -- Restaurar a Premiere
-- premiere.hab = premiere.from_hab
-- premiere.x = premiere.from_x
-- premiere.y = premiere.from_y
-- premiere.update = premiere.from_update
-- end
-- end
-- DIALEG GENERAL
function trigger_ev:dialeg_trigger ()