- Mute implementat

This commit is contained in:
2022-12-28 19:24:20 +01:00
parent 5a980fcdfb
commit 5a27c54cb3
8 changed files with 50 additions and 25 deletions

View File

@@ -10,6 +10,7 @@ actors={}
cameras={}
camera_names={[0]="GPS","Gorro","Peu de Paco","Premiere","EL_ALIEN","BatMan"}
current_camera=0
mute=false
function remove_actor(actor)
for index, value in pairs(actors) do
@@ -19,6 +20,12 @@ function remove_actor(actor)
end
end
function play(song)
if not mute then
playchirp(song)
end
end
function game_init(menu)
actors={}
cameras={}
@@ -110,7 +117,7 @@ function game_init(menu)
menu_count=0
menu_change_room=300
menu_room=rnd(60)
playchirp(audio_main_song)
play(audio_main_song)
else
_update=update_game
end
@@ -191,7 +198,7 @@ function update_game()
elseif btnp(KEY_RETURN) then
mode=modes.playing
--mapa_do_backup()
--playchirp(audio_main_song);
--play(audio_main_song);
elseif btnp(KEY_S) and (btn(KEY_LCTRL) or btn(KEY_LGUI)) then
_update=update_dialog
elseif btnp(KEY_C) then
@@ -277,6 +284,8 @@ function update_game()
abad.hab=abad.hab+10
elseif btn(KEY_LSHIFT) and btnp(KEY_UP) and hy>0 then
abad.hab=abad.hab-10
elseif btnp(KEY_M) then
mute = not mute
elseif btnp(KEY_ESCAPE) then
pause()
end
@@ -331,6 +340,13 @@ function update_menu()
if btnp(KEY_SPACE) then
game_exit()
game_init()
elseif btnp(KEY_M) then
mute = not mute
if mute then
stopchirp()
else
play(audio_main_song)
end
end
end