[NEW] Zombies amb mes d'1 de vida
[NEW] Afegits nous 'monstruitos' en la casa de Batman
This commit is contained in:
@@ -84,6 +84,9 @@ function actor_warp_update(actor)
|
|||||||
actor.warping = false
|
actor.warping = false
|
||||||
actor.frame = -1
|
actor.frame = -1
|
||||||
actor.step = 0
|
actor.step = 0
|
||||||
|
if actor.energy~=nil then
|
||||||
|
actor.energy = actor.max_energy
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif actor.step<actor.death_time/2 then
|
elseif actor.step<actor.death_time/2 then
|
||||||
|
|||||||
@@ -82,8 +82,12 @@ function stages.stage1_init()
|
|||||||
table.insert( actors, zombie.new(42, 7, 3,true) )
|
table.insert( actors, zombie.new(42, 7, 3,true) )
|
||||||
table.insert( actors, zombie.new(43, 3, 3,true) )
|
table.insert( actors, zombie.new(43, 3, 3,true) )
|
||||||
table.insert( actors, zombie.new(44, 3, 3,false) )
|
table.insert( actors, zombie.new(44, 3, 3,false) )
|
||||||
table.insert( actors, zombie.new(46, 3, 3,false) )
|
table.insert( actors, zombie.new(46, 3, 3,false,2) )
|
||||||
|
table.insert( actors, zombie.new(46, 1, 3,false) )
|
||||||
|
table.insert( actors, zombie.new(47, 9, 3,false) )
|
||||||
table.insert( actors, zombie.new(54, 3, 3,false) )
|
table.insert( actors, zombie.new(54, 3, 3,false) )
|
||||||
|
table.insert( actors, zombie.new(59, 1, 3,false) )
|
||||||
|
table.insert( actors, zombie.new(67, 8, 3,false,2) )
|
||||||
table.insert( actors, zombie.new(68, 3, 3,false) )
|
table.insert( actors, zombie.new(68, 3, 3,false) )
|
||||||
local zombie2 = zombie.new(73, 3, 3,false)
|
local zombie2 = zombie.new(73, 3, 3,false)
|
||||||
table.insert( actors, zombie2 )
|
table.insert( actors, zombie2 )
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ ch = arcade_config.character_height
|
|||||||
|
|
||||||
zombie={}
|
zombie={}
|
||||||
|
|
||||||
function zombie.new(_hab,_x,_y,_flip)
|
function zombie.new(_hab,_x,_y,_flip, _energy)
|
||||||
|
_energy = _energy or 1
|
||||||
local world_x, world_y = coords.room_to_world(_hab,_x,_y)
|
local world_x, world_y = coords.room_to_world(_hab,_x,_y)
|
||||||
return {name="zombie",
|
return {name="zombie",
|
||||||
hab=_hab,
|
hab=_hab,
|
||||||
@@ -16,6 +17,8 @@ function zombie.new(_hab,_x,_y,_flip)
|
|||||||
frame=0,
|
frame=0,
|
||||||
wait=0,
|
wait=0,
|
||||||
step=0,
|
step=0,
|
||||||
|
energy=_energy,
|
||||||
|
max_energy = _energy,
|
||||||
hit=zombie.hit,
|
hit=zombie.hit,
|
||||||
update=zombie.update_normal,
|
update=zombie.update_normal,
|
||||||
draw=zombie.draw,
|
draw=zombie.draw,
|
||||||
@@ -38,6 +41,13 @@ function zombie:draw()
|
|||||||
if not self.enabled then return end
|
if not self.enabled then return end
|
||||||
-- if self.frame>0 then draw.surf((self.frame&7)*16,(self.frame>>3)*16,16,16,self.x,self.y,16,16,self.flip) end
|
-- if self.frame>0 then draw.surf((self.frame&7)*16,(self.frame>>3)*16,16,16,self.x,self.y,16,16,self.flip) end
|
||||||
-- if self.frame>0 then draw.surf((self.frame&7)*cw,(self.frame>>cxr2)*ch,cw,ch,self.x*o2aX,self.y*o2aX,cw,ch,self.flip) end
|
-- if self.frame>0 then draw.surf((self.frame&7)*cw,(self.frame>>cxr2)*ch,cw,ch,self.x*o2aX,self.y*o2aX,cw,ch,self.flip) end
|
||||||
|
|
||||||
|
if self.energy==2 then
|
||||||
|
pal.subpal(10,14)
|
||||||
|
elseif self.energy>2 then
|
||||||
|
pal.subpal(10,9)
|
||||||
|
end
|
||||||
|
|
||||||
if self.warping then
|
if self.warping then
|
||||||
actor_warp_draw(self)
|
actor_warp_draw(self)
|
||||||
else
|
else
|
||||||
@@ -46,10 +56,13 @@ function zombie:draw()
|
|||||||
draw.surf((self.frame&7)*cw, (self.frame>>cxr2)*ch, cw, ch, scr_x, scr_y, cw, ch, self.flip)
|
draw.surf((self.frame&7)*cw, (self.frame>>cxr2)*ch, cw, ch, scr_x, scr_y, cw, ch, self.flip)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
pal.subpal(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
function zombie:update_normal()
|
function zombie:update_normal()
|
||||||
if not self.enabled then return end
|
if not self.enabled then return end
|
||||||
|
|
||||||
self.wait=self.wait+1
|
self.wait=self.wait+1
|
||||||
|
|
||||||
if self.wait==18 then
|
if self.wait==18 then
|
||||||
@@ -108,6 +121,13 @@ function zombie:update_hit()
|
|||||||
if self.can_warp then
|
if self.can_warp then
|
||||||
actor_warp_update(self)
|
actor_warp_update(self)
|
||||||
else
|
else
|
||||||
|
-- Continuar si encara te vida
|
||||||
|
if self.energy>0 then
|
||||||
|
self.update=zombie.update_normal
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Parpadejar
|
||||||
if self.step<self.death_time then
|
if self.step<self.death_time then
|
||||||
if self.step%2==0 then
|
if self.step%2==0 then
|
||||||
self.frame=self.anim[#self.anim]
|
self.frame=self.anim[#self.anim]
|
||||||
@@ -127,8 +147,13 @@ end
|
|||||||
|
|
||||||
function zombie:hit()
|
function zombie:hit()
|
||||||
if not self.enabled then return end
|
if not self.enabled then return end
|
||||||
self.update=zombie.update_hit
|
|
||||||
|
|
||||||
|
self.energy = self.energy-1
|
||||||
|
|
||||||
|
if self.energy>0 then
|
||||||
|
self.can_warp = false
|
||||||
|
else
|
||||||
|
self.can_warp = true
|
||||||
if self.can_warp then self.warping=true end
|
if self.can_warp then self.warping=true end
|
||||||
self.shrink=1
|
self.shrink=1
|
||||||
self.angle=0
|
self.angle=0
|
||||||
@@ -138,3 +163,5 @@ function zombie:hit()
|
|||||||
self.d_angle = 720 / warp_time; -- 720 = 2 voltes
|
self.d_angle = 720 / warp_time; -- 720 = 2 voltes
|
||||||
self.d_shrink = self.shrink / warp_time
|
self.d_shrink = self.shrink / warp_time
|
||||||
end
|
end
|
||||||
|
self.update=zombie.update_hit
|
||||||
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user