Zombies arounding i caco upgradat
This commit is contained in:
@@ -22,7 +22,7 @@ function caco.new(_hab,_x,_y,_flip)
|
||||
draw=caco.draw,
|
||||
jumpfwd=false,
|
||||
anim={19,19,20,21},
|
||||
bb={x=2,y=4,w=12,h=8} }
|
||||
bb={x=4,y=4,w=24,h=16} }
|
||||
end
|
||||
|
||||
function caco:draw()
|
||||
@@ -36,25 +36,43 @@ function caco:draw()
|
||||
end
|
||||
|
||||
function caco:update_normal()
|
||||
self.wait=0
|
||||
self.step=self.step+1
|
||||
if self.step<50 then
|
||||
self.frame=19
|
||||
elseif self.step==70 then
|
||||
self.frame=20
|
||||
elseif self.step==80 then
|
||||
self.frame=21
|
||||
elseif self.step==90 then
|
||||
self.step=0
|
||||
self.wait=self.wait+1
|
||||
|
||||
if self.wait==6 then
|
||||
self.wait=0
|
||||
self.step=self.step+1
|
||||
if self.step<8 then
|
||||
self.frame=19
|
||||
elseif self.step==12 then
|
||||
self.frame=20
|
||||
elseif self.step==13 then
|
||||
self.frame=21
|
||||
elseif self.step==15 then
|
||||
self.step=0
|
||||
end
|
||||
end
|
||||
|
||||
local step = 1
|
||||
if self.flip then step = -step end
|
||||
if arc_check_tile(self.x+step,self.y+self.h)<tiletype.block then
|
||||
local inc = 0
|
||||
if self.flip then inc = self.bb.w end
|
||||
|
||||
local check_x = self.x+self.bb.x+step
|
||||
local check_ywall1 = self.y+self.bb.y
|
||||
local check_ywall2 = self.y+self.h-2
|
||||
if not self.flip then
|
||||
check_x = self.x+self.bb.w+self.bb.x+step
|
||||
end
|
||||
|
||||
local check_no_wall1= arc_check_tile(check_x,check_ywall1)<tiletype.block
|
||||
local check_no_wall2= arc_check_tile(check_x,check_ywall2)<tiletype.block
|
||||
if check_no_wall1 and check_no_wall2 then
|
||||
self.x=self.x+step
|
||||
else
|
||||
self.flip=not self.flip
|
||||
end
|
||||
|
||||
|
||||
-- if self.hab==abad.hab then
|
||||
-- if aabb(abad,self) then
|
||||
-- abad_hurt(1)
|
||||
|
||||
Reference in New Issue
Block a user