[WIP] Treballant en el jefe. Almenys ja no explota, algo es algo

This commit is contained in:
2026-04-13 22:32:07 +02:00
parent a43173a940
commit d477988d10
5 changed files with 50 additions and 29 deletions

View File

@@ -160,7 +160,7 @@ function imp.new(_hab,_x,_y)
actions={no_action=0, up=1, down=2, left=4, right=8, jump=16, shot=32, super=64},
moods={stop=0, chase=1, avoid=2, neutral=4},
mood=0, --anterior fight_mode
timers={mood=150,target=150, shot=25, super=200, flip_wait=50}, --anterior *_cooldown
timers={mood=150,target=150, shot=2500, super=20000, flip_wait=50}, --anterior *_cooldown
move_types={free=0, pattern=1, super=2},
move_type=1, -- anterior movement_type
paths={}, -- Llista de "camins" a fer des d'un hot_point
@@ -173,6 +173,9 @@ function imp.new(_hab,_x,_y)
hot_points={}, -- llista de punts del mapa on anar
step_length=1,
falling = 0,
action_event="", -- Event d'acció que ha passat
jump_height=0,
max_jump_height=24,
-- funcions
next_frame = imp.staying_next_frame, -- funcio de seleccio del frame
choose_mood = imp.choose_mood,
@@ -188,6 +191,7 @@ function imp.new(_hab,_x,_y)
pattern_movement = imp.pattern_movement,
next_action = imp.next_action,
pattern_next_action = imp.pattern_next_action,
pattern_action = imp.pattern_action,
moure = imp.state_normal,
controller_input = imp.controller_input,
reduce_timers = imp.reduce_timers,
@@ -198,10 +202,12 @@ function imp.new(_hab,_x,_y)
pattern_next_target = imp.pattern_next_target,
super_next_target = imp.super_next_target,
pattern_recovery = imp.pattern_recovery,
pattern_get_next_path = imp.pattern_get_next_path,
do_jump = imp.do_jump,
land = imp.land,
shot = imp.shot,
_moure=imp._moure, -- temporal debug
advance=imp.advance,
_moure=imp._moure, -- temporal debug
}
end
@@ -272,10 +278,14 @@ function imp:update_hit()
end
function imp:update_normal()
self:reduce_timers()
print("-------------------------------------------------")
print("")
if self.pattern.target then print("TARGET= "..self.pattern.target) end
if self.pattern.target then print("ACTIONS= "..#self.pattern.actions) end
--self:reduce_timers()
-- Ajustar mood (emocions)
self:choose_mood()
--self:choose_mood()
-- analisis
self:analyze_env()
@@ -289,10 +299,10 @@ function imp:update_normal()
self:moure()
-- Logica per a selecció de frame
self:next_frame()
--self:next_frame()
-- colisions en personatges
self:colisions()
--self:colisions()
end
-- imp.next_frame()
@@ -448,13 +458,13 @@ if DEBUG_FN_NAME then print("reset_target_timer") end
end
function imp:pattern_get_next_path()
if DEBUG_FN_NAME then print("pattern_get_next_path") end
if not DEBUG_FN_NAME then print("pattern_get_next_path") end
-- obtindre uno dels possibles camins des del target en el que està
-- Si el camí s'ha acabat estarà en el punt self.path.target
local next_path_idx = math.random(#self.paths[self.path.target])
local next_path_idx = math.random(#self.paths[self.pattern.target])
self.path = self.paths[self.path.target][next_path_idx]
self.path_point = 1
self.pattern = self.paths[self.pattern.target][next_path_idx]
self.pattern_point = 1
end
function imp:create_hot_points() --OK
@@ -599,8 +609,8 @@ if DEBUG_FN_NAME then print("fight") end
self:load_pattern_paths()
self.target = self.hot_points[6]
self.pattern = {next=6, actions={{action="right",event="target"}}}
self.pattern = {target=6, actions={{action="right",event="target"}}}
print("imp2.lua -> #self.pattern.actions= "..#self.pattern.actions)
self.shot_target = abad
self.mood=self.moods.chase