- After losing a life there's some invulnerability time
This commit is contained in:
16
abad.lua
16
abad.lua
@@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
abad={x=40,y=24,flip=false,frame=1,wait=0,hab=10,vides=3,energia=40,falling=0,step=0, mustep=1,hurting=0,update=nil,jumpfwd=false,anim={0,1,0,2},bb={x=4,y=0,w=8,h=16},safe={hab=10,x=40,y=24}}
|
abad={x=40,y=24,flip=false,frame=1,wait=0,respawning=0,hab=10,vides=3,energia=40,falling=0,step=0, mustep=1,hurting=0,update=nil,jumpfwd=false,anim={0,1,0,2},bb={x=4,y=0,w=8,h=16},safe={hab=10,x=40,y=24}}
|
||||||
|
|
||||||
function abad_nop()
|
function abad_nop()
|
||||||
end
|
end
|
||||||
|
|
||||||
function abad_init()
|
function abad_init()
|
||||||
abad={x=40,y=24,flip=false,frame=1,wait=0,hab=10,vides=3,energia=40,falling=0,step=0,mustep=1,draw=abad.draw,hurting=0,update=nil,jumpfwd=false,anim={0,1,0,2},bb={x=4,y=0,w=8,h=16},safe={hab=10,x=40,y=24}}
|
abad={x=40,y=24,flip=false,frame=1,wait=0,respawning=0,hab=10,vides=3,energia=40,falling=0,step=0,mustep=1,draw=abad.draw,hurting=0,update=nil,jumpfwd=false,anim={0,1,0,2},bb={x=4,y=0,w=8,h=16},safe={hab=10,x=40,y=24}}
|
||||||
abad.update=abad_state_normal
|
abad.update=abad_state_normal
|
||||||
abad.objects={}
|
abad.objects={}
|
||||||
|
|
||||||
@@ -16,7 +16,13 @@ function abad:draw()
|
|||||||
if abad.update==abad_state_stairs then
|
if abad.update==abad_state_stairs then
|
||||||
flip=(((abad.x>>1)+(abad.y>>1))%2)==0
|
flip=(((abad.x>>1)+(abad.y>>1))%2)==0
|
||||||
end
|
end
|
||||||
|
if (abad.respawning==0) or (flr(abad.respawning/15)%2==0) then
|
||||||
sspr(abad.frame*16,0,16,16,abad.x,abad.y,16,16,flip)
|
sspr(abad.frame*16,0,16,16,abad.x,abad.y,16,16,flip)
|
||||||
|
end
|
||||||
|
|
||||||
|
if abad.respawning > 0 then
|
||||||
|
abad.respawning=abad.respawning-1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function abad_make_safe()
|
function abad_make_safe()
|
||||||
@@ -29,7 +35,7 @@ function abad_make_safe()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function abad_hurt(howmuch)
|
function abad_hurt(howmuch)
|
||||||
if abad.hurting == 0 then
|
if abad.hurting == 0 and abad.respawning==0 then
|
||||||
play(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
|
||||||
@@ -45,6 +51,7 @@ function abad_hurt(howmuch)
|
|||||||
abad.x=abad.safe.x
|
abad.x=abad.safe.x
|
||||||
abad.y=abad.safe.y
|
abad.y=abad.safe.y
|
||||||
abad.hurting=60
|
abad.hurting=60
|
||||||
|
abad.respawning=240
|
||||||
cls(3)
|
cls(3)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -60,6 +67,7 @@ function abad_state_normal()
|
|||||||
abad.jumpfwd=false
|
abad.jumpfwd=false
|
||||||
if abad.hurting > 0 then
|
if abad.hurting > 0 then
|
||||||
abad.hurting=abad.hurting-1
|
abad.hurting=abad.hurting-1
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if abad.falling>0 then
|
if abad.falling>0 then
|
||||||
@@ -83,6 +91,8 @@ function abad_state_normal()
|
|||||||
play(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 btn(KEY_Z) then
|
||||||
|
abad.respawning=240
|
||||||
elseif btnp(KEY_SPACE) and cacau.hab==-1 then
|
elseif btnp(KEY_SPACE) and cacau.hab==-1 then
|
||||||
play(audio_abad_shot)
|
play(audio_abad_shot)
|
||||||
abad.update=abad_state_fire
|
abad.update=abad_state_fire
|
||||||
|
|||||||
Reference in New Issue
Block a user