[WIP] Treballant en el jefe. Tram final

This commit is contained in:
2026-04-18 01:51:00 +02:00
parent 5843953b7b
commit 8f65666a06
4 changed files with 87 additions and 62 deletions

View File

@@ -55,6 +55,9 @@ function imp.new(_hab,_x,_y)
zoom = 1,
super_pal={[13]=13,[14]=14,[15]=15},
super_fired = false,
can_warp = false,
invencible_time = 0,
death_time=40,
--
moure = noop,
draw=imp.draw,
@@ -82,6 +85,7 @@ function imp.new(_hab,_x,_y)
pattern_recovery = imp.pattern_recovery,
super = imp.super,
super_movement = imp.super_movement,
hit = imp.hit,
-- debug
_moure = imp._moure,
_pause = false,
@@ -130,7 +134,7 @@ function imp:draw() --OK
end
function imp:hit() -- OK
if DEBUG_FN_NAME then print_dbg("hit") end
if not DEBUG_FN_NAME then print_dbg("hit") end
if not self.invencible then
self.energia = self.energia -1
if distancia(self, abad)<50 and self.invencible_time<=0 then
@@ -145,7 +149,7 @@ if DEBUG_FN_NAME then print_dbg("hit") end
self.energia = 0
-- self.enabled = false
print("END BOSS")
self.update=imp.update_hit
if self.can_warp then self.warping=true end
self.shrink=1
self.angle=0
@@ -160,6 +164,36 @@ end
function imp:update_hit()
if not self.enabled then return end
-- Que pasa quan "mor"
local step_time = self.death_time
if self.can_warp then
step_time = self.death_time/3; -- warp, wait, appear
end
self.wait=self.wait+1
if self.wait>=6 then
self.wait=0
self.step=self.step+1
if self.can_warp then
actor_warp_update(self)
else
if self.step<self.death_time then
if self.step%2==0 then
-- self.frame=21
self.frame=self.anim[#self.anim]
else
self.frame=-1
end
elseif self.step>=self.death_time then
-- self.frame=19
self.frame=self.anim[1]
self.step=0
self.wait=0
self.update=caco.update_normal
self.dying = false
end
end
end
end
function imp:update_normal()
-- print("")
@@ -191,14 +225,18 @@ function imp:update_normal()
-- moviment
self:controller_input()
self:moure()
-- Que no conte si està en modo Super
if self.stucked.x == self.x and self.stucked.y == self.y then
self.stucked.t = self.stucked.t + 1
else
self.stucked.x = self.x
self.stucked.y = self.y
self.stucked.t = 0
if self.move_type ~= self.move_types.super then
if self.stucked.x == self.x and self.stucked.y == self.y then
self.stucked.t = self.stucked.t + 1
else
self.stucked.x = self.x
self.stucked.y = self.y
self.stucked.t = 0
end
end
-- Logica per a selecció de frame
self:next_frame()
end