- Musica i so amb SDL_Mixer

This commit is contained in:
2023-01-12 19:01:38 +01:00
parent e47441ee08
commit 1a1ff51a24
34 changed files with 169 additions and 129 deletions

View File

@@ -36,16 +36,16 @@ end
function abad_hurt(howmuch)
if abad.hurting == 0 and abad.respawning==0 then
play(audio_abad_hit)
playsnd(audio_abad_hit)
abad.energia=abad.energia-howmuch
if abad.energia<=0 then
abad.vides=abad.vides-1
if abad.vides==0 then
--final de la partida
dead.start()
play(audio_game_over)
playmus(audio_game_over)
else
play(audio_life_lost)
playmus(audio_life_lost)
abad.energia=40
abad.hab=abad.safe.hab
abad.x=abad.safe.x
@@ -88,13 +88,13 @@ function abad_state_normal()
abad.update=abad_state_jumping
abad.step=0
abad.jumpfwd=false
play(audio_abad_jump)
playsnd(audio_abad_jump)
elseif btn(KEY_DOWN) then
abad.update=abad_state_crouch
elseif btn(KEY_Z) then
abad.respawning=240
elseif btnp(KEY_SPACE) and cacau.hab==-1 then
play(audio_abad_shot)
playsnd(audio_abad_shot)
abad.update=abad_state_fire
abad.wait=0
cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip)
@@ -162,7 +162,7 @@ function abad_state_walking()
abad.wait=0
abad.step=(abad.step+1)%2
if abad.step==0 then
play(audio_abad_step[abad.mustep])
playsnd(audio_abad_step[abad.mustep])
abad.mustep = abad.mustep + 1
if abad.mustep == 5 then abad.mustep=1 end
end
@@ -182,7 +182,7 @@ function abad_state_walking()
abad.update=abad_state_jumping
abad.step=0
abad.jumpfwd=true
play(audio_abad_jump)
playsnd(audio_abad_jump)
return
elseif btn(KEY_DOWN) then
abad.update=abad_state_crouch
@@ -244,7 +244,7 @@ function abad_state_jumping()
end
elseif abad.step>6 then
abad.update=abad_state_falling
play(audio_abad_fall)
playsnd(audio_abad_fall)
end
abad.step=abad.step+1
end