From cd33bc394ffec012bf42b66bdbbdaa48171523e7 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Fri, 15 May 2026 10:42:05 +0200 Subject: [PATCH] =?UTF-8?q?fase=207:=20SFX=20b=C3=A0sics=20(monedes,=20cav?= =?UTF-8?q?ar,=20mort,=20nivell,=20game=20over)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pepe_runner.lua | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/pepe_runner.lua b/pepe_runner.lua index d1b21d3..4e4dffe 100644 --- a/pepe_runner.lua +++ b/pepe_runner.lua @@ -72,6 +72,16 @@ function definir_glifs() setchar(MALO_C, 0x00,0xC3,0x66,0x3C,0x18,0x3C,0x66,0xC3) end +-- ==================================================================== +-- SFX (l'original no tenia so — afegim els minims raonables) +-- ==================================================================== +function sfx_coin() sound(2000, 40) end +function sfx_dig() play("l0o2c") end +function sfx_die() play("l1o4cl0o3bagfed") end +function sfx_malo_die() play("l0o3ao4c") end +function sfx_level() play("l1o4ceg") end +function sfx_gameover() play("l1o3bal0gfedco2c") end + function color_de(tipo) if tipo == PEDRA then return COL_PEDRA end if tipo == DINERS then return COL_DINERS end @@ -178,6 +188,7 @@ function tic_pepe() mapa[pepe.x][pepe.y].tipo = BUIT score = score + 1 diners_pantalla = diners_pantalla - 1 + sfx_coin() end -- Bordes X @@ -203,6 +214,7 @@ function mort_pepe() pepe.x = 19 pepe.y = 23 pepe.estat = NORMAL + sfx_die() end -- Inicialitza tot per a una nova partida (reset complet) @@ -223,6 +235,7 @@ function fase_nova() pepe.x = 19; pepe.y = 23; pepe.estat = NORMAL carregar_mapa(level) init_malos() + sfx_level() end -- ==================================================================== @@ -362,8 +375,8 @@ end function update_playing() -- Cavar es immediat (un sol forat per pulsacio) if pepe.estat == NORMAL then - if btnp(KEY_SPACE) and pot_cavar(-1) then foradar(pepe.x-1, pepe.y+1) end - if btnp(KEY_M) and pot_cavar( 1) then foradar(pepe.x+1, pepe.y+1) end + if btnp(KEY_SPACE) and pot_cavar(-1) then foradar(pepe.x-1, pepe.y+1); sfx_dig() end + if btnp(KEY_M) and pot_cavar( 1) then foradar(pepe.x+1, pepe.y+1); sfx_dig() end end -- Logica del joc: cada TICS frames @@ -377,6 +390,7 @@ function update_playing() end check_mapa() if pepe.vides < 0 then + sfx_gameover() set_estat(ESTAT_GAMEOVER) return end @@ -478,6 +492,7 @@ function mort_malo(m) m.carrega.ok = false m.carrega.x = 0 m.carrega.y = 0 + sfx_malo_die() end function tic_malos()