Zombies interdimensionals done!

This commit is contained in:
2026-03-31 21:31:16 +02:00
parent 1708be71a8
commit 205a98bf17
3 changed files with 157 additions and 68 deletions

View File

@@ -36,22 +36,23 @@ function caco:draw()
-- 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.warping then
local shrink_w = self.w*self.shrink
local shrink_h = self.h*self.shrink
local offset_x = math.floor((self.w-shrink_w)/2)
local offset_y = math.floor((self.h-shrink_h)/2)
local scr_x, scr_y = viewp:screen_coords( self.x+offset_x, self.y+offset_y )
shrink_w = math.floor(shrink_w)
shrink_h = math.floor(shrink_h)
-- print(shrink_w..", "..shrink_h..", "..offset_x..", "..offset_y..", "..scr_x..", "..scr_y)
if shrink_w>0 and shrink_h>0 then
draw.surfrot((self.frame&7)*cw, (self.frame>>cxr2)*ch,
cw, ch,
scr_x, scr_y,
self.angle,
shrink_w, shrink_h,
self.flip)
end
-- local shrink_w = self.w*self.shrink
-- local shrink_h = self.h*self.shrink
-- local offset_x = math.floor((self.w-shrink_w)/2)
-- local offset_y = math.floor((self.h-shrink_h)/2)
-- local scr_x, scr_y = viewp:screen_coords( self.x+offset_x, self.y+offset_y )
-- shrink_w = math.floor(shrink_w)
-- shrink_h = math.floor(shrink_h)
--
-- if shrink_w>0 and shrink_h>0 then
-- draw.surfrot((self.frame&7)*cw, (self.frame>>cxr2)*ch,
-- cw, ch,
-- scr_x, scr_y,
-- self.angle,
-- shrink_w, shrink_h,
-- self.flip)
-- end
actor_warp_draw(self)
else
if self.frame>0 then
local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
@@ -127,46 +128,49 @@ function caco:update_hit()
self.step=self.step+1
if self.can_warp then
-- warp, wait, respawn
if self.warping then
if self.step<self.death_time then
self.shrink=self.shrink-self.d_shrink
self.angle=self.angle+self.d_angle
if self.angle>=360 then self.angle = self.angle % 360 end
if self.shrink<=0 then
self.shrink=1
self.d_shrink=1
self.angle=0
self.d_angle=1
self.warping = false
self.frame = -1
self.step = 0
end
end
elseif self.step<self.death_time/2 then
self.frame = -1
elseif self.step<self.death_time then
if self.step%2==0 then
self.frame=21
else
self.frame=-1
end
elseif self.step>=self.death_time then
self.frame=19
self.step=0
self.wait=0
self.update=caco.update_normal
self.dying = false
end
-- -- warp, wait, respawn
-- if self.warping then
-- if self.step<self.death_time then
-- self.shrink=self.shrink-self.d_shrink
-- self.angle=self.angle+self.d_angle
-- if self.angle>=360 then self.angle = self.angle % 360 end
-- if self.shrink<=0 then
-- self.shrink=1
-- self.d_shrink=1
-- self.angle=0
-- self.d_angle=1
-- self.warping = false
-- self.frame = -1
-- self.step = 0
-- end
-- end
-- elseif self.step<self.death_time/2 then
-- self.frame = -1
-- elseif self.step<self.death_time then
-- if self.step%2==0 then
-- self.frame=21
-- else
-- self.frame=-1
-- end
-- elseif self.step>=self.death_time then
-- self.frame=19
-- self.step=0
-- self.wait=0
-- self.update=caco.update_normal
-- self.dying = false
-- end
actor_warp_update(self)
else
if self.step<self.death_time then
if self.step%2==0 then
self.frame=21
-- self.frame=21
self.frame=self.anim[4]
else
self.frame=-1
end
elseif self.step>=self.death_time then
self.frame=19
-- self.frame=19
self.frame=self.anim[1]
self.step=0
self.wait=0
self.update=caco.update_normal
@@ -178,15 +182,13 @@ end
function caco:hit()
self.update=caco.update_hit
self.warping=true
if self.can_warp then self.warping=true end
self.shrink=1
self.angle=0
self.dying=true
-- calcular velocitat per al warp
local warp_time = self.death_time/3
-- print(warp_time); -- 13.33
self.d_angle = 720 / warp_time; -- 720 = 2 voltes
-- print(self.d_angle); -- 54
self.d_shrink = self.shrink / warp_time
-- print(self.d_shrink); -- 2.4
end