From 71cadf86cfa180b55eae93a85598bbaf7271172c Mon Sep 17 00:00:00 2001 From: JailGamer Date: Sun, 10 May 2026 00:51:33 +0200 Subject: [PATCH] [WIP] S1 Ending. Quinta 'escena' --- data/dialeg.lua | 76 ++++++++++++++++++++++++++++++++---------- data/premiere.lua | 23 +++++++++++++ data/stage1_ending.lua | 28 +++++++++++++--- 3 files changed, 105 insertions(+), 22 deletions(-) diff --git a/data/dialeg.lua b/data/dialeg.lua index 097d9a9..f73cfaf 100644 --- a/data/dialeg.lua +++ b/data/dialeg.lua @@ -26,6 +26,46 @@ dialeg={ -- } ) -- end +function dialeg.draw_globo(x, y, w, h, flip, text) + draw.rrectf(x, y, w, h, 5, 2) + + if flip then + draw.line(x+w, y+h-1+5, x+w-20, y+h-1, 2) + draw.line(x+w, y+h-1+5, x+w-18, y+h-1, 2) + draw.line(x+w, y+h-1+5, x+w-14, y+h-1, 2) + draw.line(x+w, y+h-1+5, x+w-12, y+h-1, 2) + else + draw.line(x, y+h-1+5, x+20, y+h-1, 2) + draw.line(x, y+h-1+5, x+18, y+h-1, 2) + draw.line(x, y+h-1+5, x+14, y+h-1, 2) + draw.line(x, y+h-1+5, x+12, y+h-1, 2) + end + + local font_curr = font.current() + font.current(font_default) + draw.text(text, x+5,y+7, 16) + 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 + local x = 0 + local y = 0 + y = _y-20 + if flip then + x = _x-w + else + x = _x+_w + end + x, y = viewp:screen_coords( x, y ) + if always_visible then + if x<0 then x=0 end + if y<0 then y=0 end + end + dialeg.draw_globo(x, y, w, h, flip, text) +end + function dialeg.draw( ) local i = 1 while i <= #dialeg.list do @@ -45,24 +85,26 @@ function dialeg.draw( ) x, y = viewp:screen_coords( x, y ) - draw.rrectf(x, y, d.w, d.h, 5, 2) + -- draw.rrectf(x, y, d.w, d.h, 5, 2) + -- + -- if d.actor.flip then + -- draw.line(x+d.w, y+d.h-1+5, x+d.w-20, y+d.h-1, 2) + -- draw.line(x+d.w, y+d.h-1+5, x+d.w-18, y+d.h-1, 2) + -- draw.line(x+d.w, y+d.h-1+5, x+d.w-14, y+d.h-1, 2) + -- draw.line(x+d.w, y+d.h-1+5, x+d.w-12, y+d.h-1, 2) + -- else + -- draw.line(x, y+d.h-1+5, x+20, y+d.h-1, 2) + -- draw.line(x, y+d.h-1+5, x+18, y+d.h-1, 2) + -- draw.line(x, y+d.h-1+5, x+14, y+d.h-1, 2) + -- draw.line(x, y+d.h-1+5, x+12, y+d.h-1, 2) + -- end - if d.actor.flip then - draw.line(x+d.w, y+d.h-1+5, x+d.w-20, y+d.h-1, 2) - draw.line(x+d.w, y+d.h-1+5, x+d.w-18, y+d.h-1, 2) - draw.line(x+d.w, y+d.h-1+5, x+d.w-14, y+d.h-1, 2) - draw.line(x+d.w, y+d.h-1+5, x+d.w-12, y+d.h-1, 2) - else - draw.line(x, y+d.h-1+5, x+20, y+d.h-1, 2) - draw.line(x, y+d.h-1+5, x+18, y+d.h-1, 2) - draw.line(x, y+d.h-1+5, x+14, y+d.h-1, 2) - draw.line(x, y+d.h-1+5, x+12, y+d.h-1, 2) - end - - local font_curr = font.current() - font.current(font_default) - draw.text(d.text, x+5,y+7, 16) - font.current(font_curr) + -- local font_curr = font.current() + -- font.current(font_default) + -- draw.text(d.text, x+5,y+7, 16) + -- font.current(font_curr) + + dialeg.draw_globo(x, y, d.w, d.h, d.actor.flip, d.text) d.time = d.time-1 end diff --git a/data/premiere.lua b/data/premiere.lua index c11db24..2dccd39 100644 --- a/data/premiere.lua +++ b/data/premiere.lua @@ -326,4 +326,27 @@ function premiere.stage1_ending_update() premiere.frame=premiere.anim[premiere.step+1] end end +end + +function premiere.stage1_ending_init2() + premiere.flip = true + premiere.update = premiere.stage1_ending_update2 +end + +function premiere.stage1_ending_update2() + 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 == 7 and tx==5 and ty==3 then + -- premiere.health_wait = premiere.health_wait - 1 + premiere.flip=false + 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 \ No newline at end of file diff --git a/data/stage1_ending.lua b/data/stage1_ending.lua index 0c533eb..84b3ac7 100644 --- a/data/stage1_ending.lua +++ b/data/stage1_ending.lua @@ -12,37 +12,55 @@ function stage1_ending.update_scene(self) if self.time==0 then start_scene(scenes.stage1_ending, nil, false) -- segona escena - batman escapa - elseif self.time<120 then + elseif self.time<70 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 + elseif self.time==70 then batvio.enabled = false premiere.stage1_ending_init() elalien.stage1_ending_init() - elseif self.time<250 then + elseif self.time<200 then -- tercera escena - Aparició de elalien i premiere -- elalien 9,1,3 -> 8,6,3 -- premiere 7,6,3 -> 8,1,3 premiere.update() elalien.update() - elseif self.time==250 then + elseif self.time==200 then + -- quarta escena - dialeg entre els 3 start_scene(scenes.stage1_ending_2, nil, false) + elseif self.time==201 then + premiere.stage1_ending_init2() elseif self.time<400 then + -- quinta escena - premiere se'n va (vore dialegs draw) + premiere.update() + elseif self.time==350 then end surf.target(0) surf.cls(16) world_draw() + -- dialegs draw + if self.time>201 and self.time<300 then + -- bocadillo quinta escena (1) + dialeg.run(premiere.x, premiere.y, + premiere.w, false, + "La donnaaa e mobileee...", true) + elseif self.time>=300 and self.time<400 then + -- bocadillo quinta escena (2) + dialeg.run(premiere.x, premiere.y, + premiere.w, false, + "qual piuma al vento...", true) + end score.draw() self.time = self.time + 1 -- Acabar ending - if self.time>=350 then + if self.time>=400 then flow:next() end end