[WIP] S1 Ending. Segon troçet fet

This commit is contained in:
2026-05-09 23:24:43 +02:00
parent 30ab23758e
commit ad4ab20d90
4 changed files with 166 additions and 10 deletions
+46
View File
@@ -356,4 +356,50 @@ function elalien.update_stairs()
end
end
end
end
function elalien.backup()
-- Guardar l'estat de elalien
elalien.from_hab = elalien.hab
elalien.from_x = elalien.x
elalien.from_y = elalien.y
elalien.from_update = elalien.update
end
function elalien.restore()
-- Restaurar a elalien
elalien.hab = elalien.from_hab
elalien.x = elalien.from_x
elalien.y = elalien.from_y
elalien.update = elalien.from_update
end
function elalien.stage1_ending_init()
-- if elalien.update==premiere_update_healer then return true end
elalien.backup()
-- Moure a elalien al ending
elalien.hab = 9
elalien.x = 0
elalien.y = 3
local world_x, world_y = coords.room_to_world(elalien.hab,elalien.x,elalien.y)
elalien.x=world_x
elalien.y=world_y
elalien.update = elalien.stage1_ending_update
end
function elalien.stage1_ending_update()
elalien.wait=elalien.wait+1
-- avançar a 8,1,3
local hab, tx, ty = coords.world_to_tile(elalien.x, elalien.y)
if hab == 8 and tx==6 and ty==3 then
-- premiere.health_wait = premiere.health_wait - 1
else
elalien.x = elalien.x-1
if elalien.wait>=6 then
elalien.wait = 0
elalien.step=(elalien.step+1)%4
elalien.frame=elalien.anim[elalien.step+1]
end
end
end
+91
View File
@@ -236,3 +236,94 @@ function premiere.update_falling()
end
end
end
function 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
premiere.restore()
end
end
function premiere.backup()
-- Guardar l'estat de Premiere
premiere.from_hab = premiere.hab
premiere.from_x = premiere.x
premiere.from_y = premiere.y
premiere.from_update = premiere.update
end
function premiere.restore()
-- Restaurar a Premiere
premiere.hab = premiere.from_hab
premiere.x = premiere.from_x
premiere.y = premiere.from_y
premiere.update = premiere.from_update
end
function premiere.stage1_ending_init()
-- if premiere.update==premiere_update_healer then return true end
premiere.backup()
-- Moure a premiere al ending
premiere.hab = 7
premiere.x = 6
premiere.y = 3
local world_x, world_y = coords.room_to_world(premiere.hab,premiere.x,premiere.y)
premiere.x=world_x
premiere.y=world_y
premiere.update = premiere.stage1_ending_update
end
function premiere.stage1_ending_update()
premiere.wait=premiere.wait+1
-- avançar a 8,1,3
local hab, tx, ty = coords.world_to_tile(premiere.x, premiere.y)
if hab == 8 and tx==1 and ty==3 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
end
+1 -1
View File
@@ -230,7 +230,7 @@ function stages.stage1_boss()
trigger_event.new("Premiere Boss 1",
trigger_ev.premiere_boss1_trigger,
trigger_ev.premiere_healer_init,
trigger_ev.premiere_healer_update)
premiere.healer_update)
end
end
+28 -9
View File
@@ -5,20 +5,39 @@ stage1_ending ={
function stage1_ending:update_scene ()
print("UPDATING "..self.time)
batvio.x = batvio.x - self.batvio_vx
if self.time>=120 then
flow:next()
end
self.time = self.time + 1
if self.time % 6 == 0 then
self.batvio_vx= self.batvio_vx+1
end
batvio.update()
-- primera escena - batman escapa
if self.time<120 then
batvio.x = batvio.x - self.batvio_vx
if self.time % 6 == 0 then
self.batvio_vx= self.batvio_vx+1
end
batvio.update()
elseif self.time==120 then
batvio.enabled = false
premiere.stage1_ending_init()
elalien.stage1_ending_init()
elseif self.time<250 then
premiere.update()
elalien.update()
-- segona escena - Aparició de elalien i premiere
-- elalien 9,0,3 -> 8,6,3
-- premiere 7,6,3 -> 8,1,3
elseif self.time<300 then
end
surf.target(0)
surf.cls(16)
world_draw()
score.draw()
self.time = self.time + 1
-- Acabar ending
if self.time>=250 then
flow:next()
end
end
function stage1_ending:end_scene()