[WIP] Treballant en el jefe. Pareix que se va aclarint, pareix

This commit is contained in:
2026-04-16 22:27:13 +02:00
parent 1b812127e2
commit 956603b99c
4 changed files with 74 additions and 33 deletions

View File

@@ -100,8 +100,8 @@ if DEBUG_FN_NAME then print_dbg("choose_action "..self.mood) end
-- Si no te ganes de fer res, no moure
if self.mood==self.moods.stop then return self.actions.no_action end
if self.analisis.going_to_fall then self.action_event="prefall" end
if self.analisis.target_reached then self.action_event="target" end
if self.analisis.going_to_fall then table.insert(self.action_event, "prefall") end
-- if self.analisis.target_reached then self.action_event="target" end
if self.analisis.can_go_altar then self:super_ready() end
-- if self.fight_mode == self.fight_modes["super"] then self.action_event="super" end
-- if self.fight_mode == self.fight_modes["end_super"] then self.action_event="end_super" end
@@ -110,7 +110,7 @@ if DEBUG_FN_NAME then print_dbg("choose_action "..self.mood) end
if self.analisis.target_reached and next_action=="super" then
-- print("Super READY!")
self.action_event = "super_ready"
table.insert(self.action_event, "super_ready")
-- next_action = self:next_action()
self:super()
end
@@ -144,7 +144,7 @@ if DEBUG_FN_NAME then print_dbg("controller_input") end
self.moure~=imp.state_super) and self.action == self.actions.jump then
self:do_jump()
elseif (self.moure~=imp.state_falling and self.moure~=imp.state_jumping and
self.moure~=imp.state_super) and self.action == "jumpfwd" then
self.moure~=imp.state_super) and self.action == self.actions.jumpfwd then
self:do_jump(true)
elseif self.action == self.actions.shot then
self:shot()
@@ -153,6 +153,7 @@ if DEBUG_FN_NAME then print_dbg("controller_input") end
self.moure=imp.state_super
end
self.action = self.actions.no_action
self.action_event = {}
end
-------------------------------
@@ -176,8 +177,8 @@ end
--
-------------------------------
function imp:create_hot_points() --OK
self.pattern.node[1] = point.new(44, 5, 1, 0, 8,"P1")
self.pattern.node[2] = point.new(45, 8, 1, 0, 8,"P2")
self.pattern.node[1] = point.new(44, 6, 3, 0, 0,"P1")
self.pattern.node[2] = point.new(45, 7, 3, 0, 0,"P2")
self.pattern.node[3] = point.new(44,12, 5, 8, 0,"P3")
self.pattern.node[4] = point.new(54, 5, 4, -8, 0,"P4")
self.pattern.node[5] = point.new(54,12, 4, 8, 0,"P5")
@@ -221,7 +222,7 @@ function imp:load_pattern_paths() --OK
{action="jumpfwd", event="land"},
{action="left" , event="target"}}},
{target=6, actions= {{action="left" , event="land"},
{action="right" , event="target"}}},
{action="right" , event="target"}}},
{target=6, actions= {{action="left" , event="prefall"},
{action="jumpfwd", event="land"},
{action="right" , event="target"}}},
@@ -284,7 +285,7 @@ function imp:load_pattern_paths() --OK
{target=5, actions={{action="right" , event="prefall"},
{action="jumpfwd" , event="land"},
{action="right" , event="target"}}},
{target=9, actions={{action="right" , event="prefall"},
{target=9, actions={{action="right" , event="land"},
{action="jumpfwd" , event="land"},
{action="right" , event="target"}}},
{target=1, actions={{action="jump" , event="target"}}}
@@ -338,9 +339,13 @@ function imp:next_action()
-- Resta d'accions
if next_action==self.actions.no_action then
if self.move_type==self.move_types.free then
-- FREE
-- next_action = self:free_next_action()
elseif self.move_type==self.move_types.pattern then
if self.pattern:in_target(self) then
-- PATTERN
local in_target = self.pattern:in_target(self)
local action_event_done = in_table(self.action_event, self.pattern:event())
if in_target or action_event_done then
next_action=self.pattern:next_action()
print("TARGET => "..next_action)
else
@@ -348,6 +353,7 @@ function imp:next_action()
print("ON WAY => "..next_action)
end
elseif self.move_type==self.move_types.super then
-- SUPER
--
end
end
@@ -483,7 +489,7 @@ if DEBUG_FN_NAME then print_dbg("state_falling") end
self:_moure(imp.state_normal,"state_normal (states)")
return
end
print_dbg("FALLING!")
-- print_dbg("FALLING!")
-- Seguir caiguent
self.y=self.y+1
self.jump_height = self.jump_height-1
@@ -515,9 +521,9 @@ if DEBUG_FN_NAME then print_dbg("land") end
if can_land then
self.jump_in_half_block_used = false
self.jump_height = 0
self.action_event = "land"
table.insert(self.action_event, "land")
end
if can_land then print_dbg ("LANDED") end
-- if can_land then print_dbg ("LANDED") end
return can_land
end