- Mute implementat
This commit is contained in:
16
abad.lua
16
abad.lua
@@ -30,16 +30,16 @@ end
|
|||||||
|
|
||||||
function abad_hurt(howmuch)
|
function abad_hurt(howmuch)
|
||||||
if abad.hurting == 0 then
|
if abad.hurting == 0 then
|
||||||
playchirp(audio_abad_hit)
|
play(audio_abad_hit)
|
||||||
abad.energia=abad.energia-howmuch
|
abad.energia=abad.energia-howmuch
|
||||||
if abad.energia<=0 then
|
if abad.energia<=0 then
|
||||||
abad.vides=abad.vides-1
|
abad.vides=abad.vides-1
|
||||||
if abad.vides==0 then
|
if abad.vides==0 then
|
||||||
--final de la partida
|
--final de la partida
|
||||||
dead.start()
|
dead.start()
|
||||||
playchirp(audio_game_over, true)
|
play(audio_game_over, true)
|
||||||
else
|
else
|
||||||
playchirp(audio_life_lost, true)
|
play(audio_life_lost, true)
|
||||||
abad.energia=40
|
abad.energia=40
|
||||||
abad.hab=abad.safe.hab
|
abad.hab=abad.safe.hab
|
||||||
abad.x=abad.safe.x
|
abad.x=abad.safe.x
|
||||||
@@ -80,11 +80,11 @@ function abad_state_normal()
|
|||||||
abad.update=abad_state_jumping
|
abad.update=abad_state_jumping
|
||||||
abad.step=0
|
abad.step=0
|
||||||
abad.jumpfwd=false
|
abad.jumpfwd=false
|
||||||
playchirp(audio_abad_jump)
|
play(audio_abad_jump)
|
||||||
elseif btn(KEY_DOWN) then
|
elseif btn(KEY_DOWN) then
|
||||||
abad.update=abad_state_crouch
|
abad.update=abad_state_crouch
|
||||||
elseif btnp(KEY_SPACE) and cacau.hab==-1 then
|
elseif btnp(KEY_SPACE) and cacau.hab==-1 then
|
||||||
playchirp(audio_abad_shot)
|
play(audio_abad_shot)
|
||||||
abad.update=abad_state_fire
|
abad.update=abad_state_fire
|
||||||
abad.wait=0
|
abad.wait=0
|
||||||
cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip)
|
cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip)
|
||||||
@@ -152,7 +152,7 @@ function abad_state_walking()
|
|||||||
abad.wait=0
|
abad.wait=0
|
||||||
abad.step=(abad.step+1)%2
|
abad.step=(abad.step+1)%2
|
||||||
if abad.step==0 then
|
if abad.step==0 then
|
||||||
playchirp(audio_abad_step[abad.mustep])
|
play(audio_abad_step[abad.mustep])
|
||||||
abad.mustep = abad.mustep + 1
|
abad.mustep = abad.mustep + 1
|
||||||
if abad.mustep == 5 then abad.mustep=1 end
|
if abad.mustep == 5 then abad.mustep=1 end
|
||||||
end
|
end
|
||||||
@@ -172,7 +172,7 @@ function abad_state_walking()
|
|||||||
abad.update=abad_state_jumping
|
abad.update=abad_state_jumping
|
||||||
abad.step=0
|
abad.step=0
|
||||||
abad.jumpfwd=true
|
abad.jumpfwd=true
|
||||||
playchirp(audio_abad_jump)
|
play(audio_abad_jump)
|
||||||
return
|
return
|
||||||
elseif btn(KEY_DOWN) then
|
elseif btn(KEY_DOWN) then
|
||||||
abad.update=abad_state_crouch
|
abad.update=abad_state_crouch
|
||||||
@@ -234,7 +234,7 @@ function abad_state_jumping()
|
|||||||
end
|
end
|
||||||
elseif abad.step>6 then
|
elseif abad.step>6 then
|
||||||
abad.update=abad_state_falling
|
abad.update=abad_state_falling
|
||||||
playchirp(audio_abad_fall)
|
play(audio_abad_fall)
|
||||||
end
|
end
|
||||||
abad.step=abad.step+1
|
abad.step=abad.step+1
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ function bambolla.update_normal()
|
|||||||
end
|
end
|
||||||
bambolla.y=28-abs(sin(bambolla.x*0.1))*24
|
bambolla.y=28-abs(sin(bambolla.x*0.1))*24
|
||||||
if bambolla.hab==abad.hab and bambolla.y>25.2 then
|
if bambolla.hab==abad.hab and bambolla.y>25.2 then
|
||||||
playchirp(audio_low)
|
play(audio_low)
|
||||||
end
|
end
|
||||||
if bambolla.hab==abad.hab then
|
if bambolla.hab==abad.hab then
|
||||||
if cacau.hab==bambolla.hab and aabb(bambolla,cacau) then
|
if cacau.hab==bambolla.hab and aabb(bambolla,cacau) then
|
||||||
@@ -89,7 +89,7 @@ function bambolla.update_normal()
|
|||||||
bambolla.y=bambolla.y+8
|
bambolla.y=bambolla.y+8
|
||||||
bambolla.dx=0
|
bambolla.dx=0
|
||||||
bambolla.dy=-4
|
bambolla.dy=-4
|
||||||
playchirp(audio_hit)
|
play(audio_hit)
|
||||||
end
|
end
|
||||||
if aabb(bambolla,abad) then
|
if aabb(bambolla,abad) then
|
||||||
abad_hurt(1)
|
abad_hurt(1)
|
||||||
|
|||||||
20
game.lua
20
game.lua
@@ -10,6 +10,7 @@ actors={}
|
|||||||
cameras={}
|
cameras={}
|
||||||
camera_names={[0]="GPS","Gorro","Peu de Paco","Premiere","EL_ALIEN","BatMan"}
|
camera_names={[0]="GPS","Gorro","Peu de Paco","Premiere","EL_ALIEN","BatMan"}
|
||||||
current_camera=0
|
current_camera=0
|
||||||
|
mute=false
|
||||||
|
|
||||||
function remove_actor(actor)
|
function remove_actor(actor)
|
||||||
for index, value in pairs(actors) do
|
for index, value in pairs(actors) do
|
||||||
@@ -19,6 +20,12 @@ function remove_actor(actor)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function play(song)
|
||||||
|
if not mute then
|
||||||
|
playchirp(song)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function game_init(menu)
|
function game_init(menu)
|
||||||
actors={}
|
actors={}
|
||||||
cameras={}
|
cameras={}
|
||||||
@@ -110,7 +117,7 @@ function game_init(menu)
|
|||||||
menu_count=0
|
menu_count=0
|
||||||
menu_change_room=300
|
menu_change_room=300
|
||||||
menu_room=rnd(60)
|
menu_room=rnd(60)
|
||||||
playchirp(audio_main_song)
|
play(audio_main_song)
|
||||||
else
|
else
|
||||||
_update=update_game
|
_update=update_game
|
||||||
end
|
end
|
||||||
@@ -191,7 +198,7 @@ function update_game()
|
|||||||
elseif btnp(KEY_RETURN) then
|
elseif btnp(KEY_RETURN) then
|
||||||
mode=modes.playing
|
mode=modes.playing
|
||||||
--mapa_do_backup()
|
--mapa_do_backup()
|
||||||
--playchirp(audio_main_song);
|
--play(audio_main_song);
|
||||||
elseif btnp(KEY_S) and (btn(KEY_LCTRL) or btn(KEY_LGUI)) then
|
elseif btnp(KEY_S) and (btn(KEY_LCTRL) or btn(KEY_LGUI)) then
|
||||||
_update=update_dialog
|
_update=update_dialog
|
||||||
elseif btnp(KEY_C) then
|
elseif btnp(KEY_C) then
|
||||||
@@ -277,6 +284,8 @@ function update_game()
|
|||||||
abad.hab=abad.hab+10
|
abad.hab=abad.hab+10
|
||||||
elseif btn(KEY_LSHIFT) and btnp(KEY_UP) and hy>0 then
|
elseif btn(KEY_LSHIFT) and btnp(KEY_UP) and hy>0 then
|
||||||
abad.hab=abad.hab-10
|
abad.hab=abad.hab-10
|
||||||
|
elseif btnp(KEY_M) then
|
||||||
|
mute = not mute
|
||||||
elseif btnp(KEY_ESCAPE) then
|
elseif btnp(KEY_ESCAPE) then
|
||||||
pause()
|
pause()
|
||||||
end
|
end
|
||||||
@@ -331,6 +340,13 @@ function update_menu()
|
|||||||
if btnp(KEY_SPACE) then
|
if btnp(KEY_SPACE) then
|
||||||
game_exit()
|
game_exit()
|
||||||
game_init()
|
game_init()
|
||||||
|
elseif btnp(KEY_M) then
|
||||||
|
mute = not mute
|
||||||
|
if mute then
|
||||||
|
stopchirp()
|
||||||
|
else
|
||||||
|
play(audio_main_song)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
2
gota.lua
2
gota.lua
@@ -22,7 +22,7 @@ function gota:update_normal()
|
|||||||
self.cx=self.x+2
|
self.cx=self.x+2
|
||||||
self.dx=0
|
self.dx=0
|
||||||
self.dy=-4
|
self.dy=-4
|
||||||
if self.hab==abad.hab then playchirp(audio_low) end
|
if self.hab==abad.hab then play(audio_low) end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
--self.flip=not self.flip
|
--self.flip=not self.flip
|
||||||
|
|||||||
4
imp.lua
4
imp.lua
@@ -73,7 +73,7 @@ function imp.update()
|
|||||||
imp.x=imp.x-2
|
imp.x=imp.x-2
|
||||||
if imp.x==78 then
|
if imp.x==78 then
|
||||||
fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip)
|
fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip)
|
||||||
playchirp(audio_hit)
|
play(audio_hit)
|
||||||
imp.flip=not imp.flip
|
imp.flip=not imp.flip
|
||||||
elseif imp.x==-12 then
|
elseif imp.x==-12 then
|
||||||
imp.reset()
|
imp.reset()
|
||||||
@@ -82,7 +82,7 @@ function imp.update()
|
|||||||
imp.x=imp.x+2
|
imp.x=imp.x+2
|
||||||
if imp.x==4 then
|
if imp.x==4 then
|
||||||
fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip)
|
fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip)
|
||||||
playchirp(audio_hit)
|
play(audio_hit)
|
||||||
imp.flip=not imp.flip
|
imp.flip=not imp.flip
|
||||||
elseif imp.x==92 then
|
elseif imp.x==92 then
|
||||||
imp.reset()
|
imp.reset()
|
||||||
|
|||||||
@@ -29,13 +29,18 @@ function intro_intro()
|
|||||||
intro_wait=40
|
intro_wait=40
|
||||||
_update = intro_update
|
_update = intro_update
|
||||||
end
|
end
|
||||||
|
if btnp(KEY_M) then
|
||||||
|
mute = not mute
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function intro_update()
|
function intro_update()
|
||||||
--playchirp(audio_main_song)
|
--play(audio_main_song)
|
||||||
--game_init(true)
|
--game_init(true)
|
||||||
if btnp(KEY_ESCAPE) then
|
if btnp(KEY_ESCAPE) then
|
||||||
game_init(true)
|
game_init(true)
|
||||||
|
elseif btnp(KEY_M) then
|
||||||
|
mute = not mute
|
||||||
end
|
end
|
||||||
|
|
||||||
intro_wait=intro_wait-1
|
intro_wait=intro_wait-1
|
||||||
@@ -82,7 +87,7 @@ function intro_update()
|
|||||||
start_scene(scenes.intro_04,58)
|
start_scene(scenes.intro_04,58)
|
||||||
intro_step=7
|
intro_step=7
|
||||||
elseif intro_step==7 then
|
elseif intro_step==7 then
|
||||||
playchirp(audio_main_song)
|
play(audio_main_song)
|
||||||
game_init(true)
|
game_init(true)
|
||||||
end
|
end
|
||||||
intro_wait=40
|
intro_wait=40
|
||||||
|
|||||||
14
scenes.lua
14
scenes.lua
@@ -156,7 +156,7 @@ function draw_scene()
|
|||||||
if scenes.char<#scenes.current_scene[scenes.dnum].text[1] then
|
if scenes.char<#scenes.current_scene[scenes.dnum].text[1] then
|
||||||
scenes.step=scenes.step-1
|
scenes.step=scenes.step-1
|
||||||
scenes.char=scenes.char+1
|
scenes.char=scenes.char+1
|
||||||
playchirp(scenes.current_scene[scenes.dnum].audio)
|
play(scenes.current_scene[scenes.dnum].audio)
|
||||||
else
|
else
|
||||||
scenes.char=1
|
scenes.char=1
|
||||||
end
|
end
|
||||||
@@ -165,7 +165,7 @@ function draw_scene()
|
|||||||
if scenes.char<#scenes.current_scene[scenes.dnum].text[2] then
|
if scenes.char<#scenes.current_scene[scenes.dnum].text[2] then
|
||||||
scenes.step=scenes.step-1
|
scenes.step=scenes.step-1
|
||||||
scenes.char=scenes.char+1
|
scenes.char=scenes.char+1
|
||||||
playchirp(scenes.current_scene[scenes.dnum].audio)
|
play(scenes.current_scene[scenes.dnum].audio)
|
||||||
else
|
else
|
||||||
scenes.char=1
|
scenes.char=1
|
||||||
end
|
end
|
||||||
@@ -174,7 +174,7 @@ function draw_scene()
|
|||||||
if scenes.char<#scenes.current_scene[scenes.dnum].text[3] then
|
if scenes.char<#scenes.current_scene[scenes.dnum].text[3] then
|
||||||
scenes.step=scenes.step-1
|
scenes.step=scenes.step-1
|
||||||
scenes.char=scenes.char+1
|
scenes.char=scenes.char+1
|
||||||
playchirp(scenes.current_scene[scenes.dnum].audio)
|
play(scenes.current_scene[scenes.dnum].audio)
|
||||||
else
|
else
|
||||||
scenes.char=1
|
scenes.char=1
|
||||||
end
|
end
|
||||||
@@ -218,10 +218,12 @@ function update_scene()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if btnp(KEY_ESCAPE) then
|
if btnp(KEY_ESCAPE) then
|
||||||
|
if scenes.current_scene[scenes.dnum].die then
|
||||||
|
game_init(true)
|
||||||
|
else
|
||||||
pause()
|
pause()
|
||||||
end
|
end
|
||||||
|
elseif btnp(KEY_SPACE) then
|
||||||
if btnp(KEY_SPACE) then
|
|
||||||
if scenes.step>8 then
|
if scenes.step>8 then
|
||||||
if scenes.dnum==#scenes.current_scene then
|
if scenes.dnum==#scenes.current_scene then
|
||||||
--freesurf(bkg)
|
--freesurf(bkg)
|
||||||
@@ -233,5 +235,7 @@ function update_scene()
|
|||||||
else
|
else
|
||||||
scenes.step=8
|
scenes.step=8
|
||||||
end
|
end
|
||||||
|
elseif btnp(KEY_M) then
|
||||||
|
mute = not mute
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ function switches.start(hab,tile)
|
|||||||
switches.current_index=2
|
switches.current_index=2
|
||||||
switches.wait=0
|
switches.wait=0
|
||||||
switches.cooldown=60
|
switches.cooldown=60
|
||||||
playchirp(audio_switch)
|
play(audio_switch)
|
||||||
end
|
end
|
||||||
|
|
||||||
function switches.update()
|
function switches.update()
|
||||||
|
|||||||
Reference in New Issue
Block a user