[NEW] Zombies amb mes d'1 de vida

[NEW] Afegits nous 'monstruitos' en la casa de Batman
This commit is contained in:
2026-05-03 00:26:24 +02:00
parent e59be0c33f
commit 7faf7049fd
3 changed files with 45 additions and 11 deletions

View File

@@ -84,6 +84,9 @@ function actor_warp_update(actor)
actor.warping = false
actor.frame = -1
actor.step = 0
if actor.energy~=nil then
actor.energy = actor.max_energy
end
end
end
elseif actor.step<actor.death_time/2 then

View File

@@ -82,8 +82,12 @@ function stages.stage1_init()
table.insert( actors, zombie.new(42, 7, 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(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(59, 1, 3,false) )
table.insert( actors, zombie.new(67, 8, 3,false,2) )
table.insert( actors, zombie.new(68, 3, 3,false) )
local zombie2 = zombie.new(73, 3, 3,false)
table.insert( actors, zombie2 )

View File

@@ -4,7 +4,8 @@ ch = arcade_config.character_height
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)
return {name="zombie",
hab=_hab,
@@ -16,6 +17,8 @@ function zombie.new(_hab,_x,_y,_flip)
frame=0,
wait=0,
step=0,
energy=_energy,
max_energy = _energy,
hit=zombie.hit,
update=zombie.update_normal,
draw=zombie.draw,
@@ -38,6 +41,13 @@ function zombie:draw()
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)*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
actor_warp_draw(self)
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)
end
end
pal.subpal(10)
end
function zombie:update_normal()
if not self.enabled then return end
self.wait=self.wait+1
if self.wait==18 then
@@ -108,6 +121,13 @@ function zombie:update_hit()
if self.can_warp then
actor_warp_update(self)
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%2==0 then
self.frame=self.anim[#self.anim]
@@ -127,8 +147,13 @@ end
function zombie:hit()
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
self.shrink=1
self.angle=0
@@ -137,4 +162,6 @@ function zombie:hit()
local warp_time = self.death_time/3
self.d_angle = 720 / warp_time; -- 720 = 2 voltes
self.d_shrink = self.shrink / warp_time
end
self.update=zombie.update_hit
end