From d4b45df65f443d4a763b76bf0147eb1ec8374ed8 Mon Sep 17 00:00:00 2001 From: JailGamer Date: Sun, 24 May 2026 13:34:15 +0200 Subject: [PATCH] =?UTF-8?q?[NEW]=20Transformada=20la=20pantalla=20de=20gam?= =?UTF-8?q?e=20over=20a=20estat=20(canvia=20dead.lua=20per=20game=5Fover.l?= =?UTF-8?q?ua)=20[FIX]=20Centrat=20en=20la=20pantalla=20de=20les=20opcions?= =?UTF-8?q?=20del=20t=C3=ADtol?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/abad.lua | 7 +++--- data/dead.lua | 46 -------------------------------------- data/game_over.lua | 55 ++++++++++++++++++++++++++++++++++++++++++++++ data/main.lua | 1 + data/title.lua | 4 ++-- 5 files changed, 61 insertions(+), 52 deletions(-) delete mode 100644 data/dead.lua create mode 100644 data/game_over.lua diff --git a/data/abad.lua b/data/abad.lua index 39509f2..966f3a4 100644 --- a/data/abad.lua +++ b/data/abad.lua @@ -2,8 +2,6 @@ cw = arcade_config.character_width ch = arcade_config.character_height -require "dead" - -- abad={ x=40, y=24, -- flip=false, -- frame=1, @@ -159,8 +157,9 @@ function abad_hurt(howmuch) abad.vides=abad.vides-1 if abad.vides==0 then --final de la partida - dead.start() - music.play(audio_game_over,0) + states:executar("game over",false) + -- dead.start() + -- music.play(audio_game_over,0) else music.play(audio_life_lost,0) abad.energia=abad.max_energia diff --git a/data/dead.lua b/data/dead.lua deleted file mode 100644 index 3037e20..0000000 --- a/data/dead.lua +++ /dev/null @@ -1,46 +0,0 @@ -dead={} - -function dead.start() - dead.count=0 - dead.pos={} - dead.vel={} - for i=1,128 do - dead.pos[i]=0 - dead.vel[i]=(200+math.random(0,399))/400 - end - game_update=dead.update -end - -function dead.update() - dead.count=dead.count+1 - for i=1,128 do - if dead.pos[i]<96 then - dead.pos[i]=dead.pos[i]+dead.vel[i] - draw.vline(i-1,0,dead.pos[i],16) - end - end - if dead.count>50 then - if dead.count>130 then - draw.text("GAME OVER",44,40,2) - elseif dead.count>120 then - draw.text("GAME OVE",44,40,2) - elseif dead.count>110 then - draw.text("GAME OV",44,40,2) - elseif dead.count>100 then - draw.text("GAME O",44,40,2) - elseif dead.count>90 then - draw.text("GAME",44,40,2) - elseif dead.count>80 then - draw.text("GAM",44,40,2) - elseif dead.count>70 then - draw.text("GA",44,40,2) - elseif dead.count>60 then - draw.text("G",44,40,2) - end - end - - if (dead.count>250 and (key.press(keyShoot) or pad.press(btnShoot))) or dead.count>500 then - game_exit() - game_init(true) - end -end \ No newline at end of file diff --git a/data/game_over.lua b/data/game_over.lua new file mode 100644 index 0000000..23a145d --- /dev/null +++ b/data/game_over.lua @@ -0,0 +1,55 @@ +dead={} + +function game_over_init() + dead.count=0 + dead.pos={} + dead.vel={} + for i=1,256 do + dead.pos[i]=0 + dead.vel[i]=(200+math.random(0,399))/400 + end + -- game_update=dead.update + music.play(audio_game_over,0) + states:next() +end + +function game_over_update() + dead.count=dead.count+1 + for i=1,256 do + if dead.pos[i]<192 then + dead.pos[i]=dead.pos[i]+dead.vel[i] + draw.vline(i-1,0,dead.pos[i],16) + end + end + if dead.count>50 then + if dead.count>130 then + draw.text("GAME OVER",96,90,2) + elseif dead.count>120 then + draw.text("GAME OVE",96,90,2) + elseif dead.count>110 then + draw.text("GAME OV",96,90,2) + elseif dead.count>100 then + draw.text("GAME O",96,90,2) + elseif dead.count>90 then + draw.text("GAME",96,90,2) + elseif dead.count>90 then + draw.text("GAM",96,90,2) + elseif dead.count>70 then + draw.text("GA",96,90,2) + elseif dead.count>60 then + draw.text("G",96,90,2) + end + end + + if (dead.count>250 and (key.press(keyShoot) or pad.press(btnShoot))) or dead.count>500 then + -- game_exit() + -- game_init(true) + states:next() + end +end + +function game_over_end() + states:executar("title",false) +end + +states:registrar("game over",{game_over_init, game_over_update, game_over_end}) \ No newline at end of file diff --git a/data/main.lua b/data/main.lua index d1c122e..da52f28 100644 --- a/data/main.lua +++ b/data/main.lua @@ -19,6 +19,7 @@ require "opcions" require "opcions_input" require "point" require "pause" +require "game_over" require "fps" --require "menu" diff --git a/data/title.lua b/data/title.lua index e2f7bec..3fd031c 100644 --- a/data/title.lua +++ b/data/title.lua @@ -143,8 +143,8 @@ end function title_menu_draw() draw_shiny_rect(56,120+(20*menu_sel)-4,146,18,14,15) - arc_text("JUGAR", 108, 120, 14) - arc_text("OPCIONS", 102, 140, 14) + arc_text("JUGAR", 111, 120, 14) + arc_text("OPCIONS", 104, 140, 14) end function title_menu_update()