fase 7: SFX bàsics (monedes, cavar, mort, nivell, game over)

This commit is contained in:
2026-05-15 10:42:05 +02:00
parent 82896750c1
commit cd33bc394f
+17 -2
View File
@@ -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()