- [NEW] Música per a l'imp

- [NEW] Escena amb l'imp
- [FIX] scenes.lua - La música pot arrancar en qualsevol escena
This commit is contained in:
2026-04-04 00:58:03 +02:00
parent 9ab8c80a56
commit 73122ebb78
8 changed files with 148 additions and 36 deletions

View File

@@ -170,6 +170,7 @@ function game_init(menu)
table.insert( actors, trigger.new(19,32,32,triggers.escena_habitacio_batman,"habitacio batman"))
--
table.insert( actors, trigger.new(55,1,3,triggers.escena_lluita_imp,"lluita imp"))
-- table.insert(actors,trigger.new(14,40,32,triggers.teleport_a))
-- table.insert(actors,trigger.new(67,8,32,triggers.teleport_b))
-- table.insert(actors,trigger.new(29,40,32,triggers.teleport_c))
@@ -178,6 +179,7 @@ function game_init(menu)
score.create()
local abad_x, abad_y = coords.room_to_world ( 10, 4, 3 )
-- local abad_x, abad_y = coords.room_to_world ( 54, 8, 3 )
abad:move(abad_x, abad_y)
abad_make_safe( true )
@@ -285,13 +287,14 @@ function update_game()
cacau:draw()
score.draw()
-- viewp:print()
-- msg_print(0,14,"ABAD= "..abad.x..", "..abad.y, true)
-- msg_print(0,21,"VIEW= "..vp_x..", "..vp_y, true)
-- local hab, xx, yy = coords.world_to_tile(abad.x, abad.y)
-- msg_print(0,28,hab.." ( "..xx..", "..yy.." )", true)
-- msg_print(0,35,hab.." ( "..xx..", "..yy.." )", true)
font.current(font_default)
viewp:print()
msg_print(0,14,"ABAD= "..abad.x..", "..abad.y, true)
msg_print(0,21,"VIEW= "..vp_x..", "..vp_y, true)
local hab, xx, yy = coords.world_to_tile(abad.x, abad.y)
msg_print(0,28,hab.." ( "..xx..", "..yy.." )", true)
msg_print(0,35,hab.." ( "..xx..", "..yy.." )", true)
-- msg_print(0,42," JH= "..abad.jump_height,true)
-- view_coord(abad.x+8, abad.y+0, 16, 32, 6)
@@ -330,6 +333,82 @@ function update_game()
-- end
-- msg_print(abad.x, abad.y-8,msg)
-- end
font.current(font_sf)
end
function pause()
print("pause()")
-- surf.source(0)
-- surf.target(back)
-- draw.surf(0,0,128,96,0,0)
-- surf.target(0)
-- surf.source(tiles)
-- pausa_option=1
-- pause_old_update=game_update
-- game_update=update_pause
end
function update_pause()
draw.rectf(16,16,97,65,16)
draw.rect(16,16,97,65,15)
draw.text("PAUSA",54,20,15)
menu_count=menu_count+1
local parpadeig=false
if menu_count>=20 then
parpadeig=true
if menu_count>40 then menu_count=0 end
end
draw.rect(28,33+(10*(pausa_option-1)),73,9,14)
if (not parpadeig) then draw.rect(28,33+(10*(pausa_option-1)),73,9,13) end
--draw.rect(28,33+(10*(pausa_option-1)),73,9,13)
draw.text("CONTINUAR",30,35,14)
draw.text("MUSICA:",30,45,14)
if music.enabled() then
draw.text("SI",91,45,15)
else
draw.text("NO",91,45,15)
end
draw.text("SÓ:",30,55,14)
if sound.enabled() then
draw.text("SI",91,55,15)
else
draw.text("NO",91,55,15)
end
draw.text("EIXIR",30,65,14)
if key.press(key.ESCAPE) then
surf.source(back)
draw.surf(0,0,128,96,0,0)
surf.source(tiles)
game_update = pause_old_update
elseif key.press(keyDown) or pad.press(btnDown) then
pausa_option = pausa_option + 1
if pausa_option == 5 then pausa_option = 1 end
elseif key.press(keyUp) or pad.press(btnUp) then
pausa_option = pausa_option - 1
if pausa_option == 0 then pausa_option = 4 end
elseif key.press(keyShoot) or pad.press(btnShoot) then
if pausa_option==1 then
surf.source(back)
draw.surf(0,0,128,96,0,0)
surf.source(tiles)
game_update = pause_old_update
elseif pausa_option==2 then
music.enabled(not music.enabled())
elseif pausa_option==3 then
sound.enabled(not sound.enabled())
else
game_exit()
game_init(true)
end
end
end
flow:registrar("game", {game_init, update_game} )