diff --git a/abad.lua b/abad.lua index 3ff08b7..92d4b76 100644 --- a/abad.lua +++ b/abad.lua @@ -2,7 +2,7 @@ abad={x=40,y=24,flip=false,frame=1,wait=0,hab=10,vides=3,energia=40,falling=0,step=0,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_init() - abad={x=40,y=24,flip=false,frame=1,wait=0,hab=10,vides=3,energia=40,falling=0,step=0,draw=abad.draw,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,hab=10,vides=3,energia=40,falling=0,step=0,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.objects={} @@ -26,7 +26,7 @@ function abad_make_safe() end function abad_hurt(howmuch) - if not abad.hurting then + if abad.hurting == 0 then abad.energia=abad.energia-howmuch if abad.energia<=0 then abad.vides=abad.vides-1 @@ -38,7 +38,7 @@ function abad_hurt(howmuch) abad.hab=abad.safe.hab abad.x=abad.safe.x abad.y=abad.safe.y - abad.hurting=10 + abad.hurting=60 cls(3) end else diff --git a/main.lua b/main.lua index b5fb77b..b352fa0 100644 --- a/main.lua +++ b/main.lua @@ -201,16 +201,24 @@ function update_game() rect(tx,ty,tx+8,ty+8,3) end else - if not abad.hurting then - draw_hab(abad.hab,0,0) - --text(abad.hab,1,1,2) - draw_hab(cameras[current_camera].hab,0,48) - text(camera_names[current_camera],2,49,8) + if abad.hurting == 0 then + draw_hab(abad.hab,0,0) + --text(abad.hab,1,1,2) + draw_hab(cameras[current_camera].hab,0,48) + text(camera_names[current_camera],2,49,8) - score.draw() - setsource(tiles) - prnt("x"..abad.vides,114,13,2) - rectfill(102+(abad.energia>>1),30,122,37,16) + score.draw() + setsource(tiles) + prnt("x"..abad.vides,114,13,2) + rectfill(102+(abad.energia>>1),30,122,37,16) + else + sspr(0,0,16,9,50,40,16,9,true) + if abad.hurting > 40 then + prnt("x"..abad.vides+1,63,43,3) + elseif abad.hurting < 20 then + prnt("x"..abad.vides,63,43,2) + end + end mapa_update(abad.hab,cameras[current_camera].hab)