forked from JailDoctor/cacaus
- [NEW] Sound everywhere
- Game logic extracted to game.lua
This commit is contained in:
6
abad.lua
6
abad.lua
@@ -27,13 +27,16 @@ end
|
||||
|
||||
function abad_hurt(howmuch)
|
||||
if abad.hurting == 0 then
|
||||
playchirp(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()
|
||||
playchirp(audio_game_over, true)
|
||||
else
|
||||
playchirp(audio_life_lost, true)
|
||||
abad.energia=40
|
||||
abad.hab=abad.safe.hab
|
||||
abad.x=abad.safe.x
|
||||
@@ -78,6 +81,7 @@ function abad_state_normal()
|
||||
elseif btn(KEY_DOWN) then
|
||||
abad.update=abad_state_crouch
|
||||
elseif btnp(KEY_SPACE) and cacau.hab==-1 then
|
||||
playchirp(audio_abad_shot)
|
||||
abad.update=abad_state_fire
|
||||
abad.wait=0
|
||||
cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip)
|
||||
@@ -143,7 +147,7 @@ function abad_state_walking()
|
||||
|
||||
if abad.wait==6 then
|
||||
abad.wait=0
|
||||
abad.step=(abad.step+1)%4
|
||||
abad.step=(abad.step+1)%2
|
||||
if abad.step==0 then
|
||||
playchirp(audio_abad_step[abad.mustep])
|
||||
abad.mustep = abad.mustep + 1
|
||||
|
||||
Reference in New Issue
Block a user