[WIP] Treballant en el jefe. Per fi torna a ser jugable! Ara a pels detalls

This commit is contained in:
2026-04-18 18:45:58 +02:00
parent 8f65666a06
commit dab08a0f17
18 changed files with 144 additions and 2577 deletions

View File

@@ -57,7 +57,8 @@ function imp.new(_hab,_x,_y)
super_fired = false,
can_warp = false,
invencible_time = 0,
death_time=40,
disappear_time=40,
disappearing = false,
--
moure = noop,
draw=imp.draw,
@@ -86,18 +87,22 @@ function imp.new(_hab,_x,_y)
super = imp.super,
super_movement = imp.super_movement,
hit = imp.hit,
warp_update = imp.warp_update,
-- debug
_moure = imp._moure,
_pause = false,
_step = imp._step,
}
end
function imp:draw() --OK
self.pattern:draw()
local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
-- Modo super
if self.moure==imp.state_super then
if self.warping then
actor_warp_draw(self)
elseif self.moure==imp.state_super then
-- Modo super
-- rotar paleta
for col=13,15 do
local newc = self.super_pal[col]
@@ -124,17 +129,18 @@ function imp:draw() --OK
pal.subpal(5)
end
draw.rect(scr_x+self.bb.x,scr_y+self.bb.h, self.bb.w, 8,2)
local wtx, wty = coords.room_to_world(hab1, tx1, ty1)
local scr_x, scr_y = viewp:screen_coords( wtx, wty )
draw.rect(scr_x, scr_y, 16, 16, 15)
local wtx, wty = coords.room_to_world(hab2, tx2, ty2)
local scr_x, scr_y = viewp:screen_coords( wtx, wty )
draw.rect(scr_x, scr_y, 16, 16, 13)
-- draw.rect(scr_x+self.bb.x,scr_y+self.bb.h, self.bb.w, 8,2)
-- local wtx, wty = coords.room_to_world(hab1, tx1, ty1)
-- local scr_x, scr_y = viewp:screen_coords( wtx, wty )
-- draw.rect(scr_x, scr_y, 16, 16, 15)
-- local wtx, wty = coords.room_to_world(hab2, tx2, ty2)
-- local scr_x, scr_y = viewp:screen_coords( wtx, wty )
-- draw.rect(scr_x, scr_y, 16, 16, 13)
end
function imp:hit() -- OK
if not DEBUG_FN_NAME then print_dbg("hit") end
if self.energia <= 0 then return end
if 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
@@ -148,53 +154,77 @@ if not DEBUG_FN_NAME then print_dbg("hit") end
if self.energia <= 0 then
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
self.dying=true
self.disappearing=true
-- calcular velocitat per al warp
local warp_time = self.death_time/3
local warp_time = self.disappear_time/3
self.d_angle = 720 / warp_time; -- 720 = 2 voltes
self.d_shrink = self.shrink / warp_time
self.update=imp.update_disappearing
end
end
function imp:update_hit()
function imp:_step( value, foo )
foo = foo or "anonymous"
-- print_dbg(foo)
self.step = value
end
function imp:warp_update()
-- warp, wait, respawn
if self.warping then
if self.step<self.disappear_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
-- Ha desaparegut
self.shrink=1
self.d_shrink=1
self.angle=0
self.d_angle=1
self.warping = false
self.frame = -1
-- self.can_warp = false
-- self.step = 0
end
end
else
self.can_warp = false
end
end
function imp:update_disappearing()
-- print_dbg(">>>>>>>>>> update_hit")
if not self.enabled then return end
-- Que pasa quan "mor"
local step_time = self.death_time
local step_time = self.disappear_time
if self.can_warp then
step_time = self.death_time/3; -- warp, wait, appear
step_time = self.disappear_time/2; -- warp, wait
end
self.wait=self.wait+1
-- print(self.step)
if self.wait>=6 then
self.wait=0
self.step=self.step+1
-- self.step=self.step+1
self:_step(self.step+1,"update_hit")
if self.can_warp then
actor_warp_update(self)
self:warp_update()
self.moure = self.noop
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
self.enabled = false
print("END BOSS")
stages.stage1_boss_finished()
end
end
end
function imp:update_normal()
-- print("")
-- print("TARGET TIMER= "..self.timers.target)