[WIP] Treballant en el jefe. Almenys ja no explota, algo es algo
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,6 +3,7 @@ release/*
|
|||||||
*.exe
|
*.exe
|
||||||
*.dll
|
*.dll
|
||||||
*.xcf
|
*.xcf
|
||||||
|
desktop.ini
|
||||||
mini
|
mini
|
||||||
mini_debug
|
mini_debug
|
||||||
data-old
|
data-old
|
||||||
|
|||||||
@@ -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},
|
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},
|
moods={stop=0, chase=1, avoid=2, neutral=4},
|
||||||
mood=0, --anterior fight_mode
|
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_types={free=0, pattern=1, super=2},
|
||||||
move_type=1, -- anterior movement_type
|
move_type=1, -- anterior movement_type
|
||||||
paths={}, -- Llista de "camins" a fer des d'un hot_point
|
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
|
hot_points={}, -- llista de punts del mapa on anar
|
||||||
step_length=1,
|
step_length=1,
|
||||||
falling = 0,
|
falling = 0,
|
||||||
|
action_event="", -- Event d'acció que ha passat
|
||||||
|
jump_height=0,
|
||||||
|
max_jump_height=24,
|
||||||
-- funcions
|
-- funcions
|
||||||
next_frame = imp.staying_next_frame, -- funcio de seleccio del frame
|
next_frame = imp.staying_next_frame, -- funcio de seleccio del frame
|
||||||
choose_mood = imp.choose_mood,
|
choose_mood = imp.choose_mood,
|
||||||
@@ -188,6 +191,7 @@ function imp.new(_hab,_x,_y)
|
|||||||
pattern_movement = imp.pattern_movement,
|
pattern_movement = imp.pattern_movement,
|
||||||
next_action = imp.next_action,
|
next_action = imp.next_action,
|
||||||
pattern_next_action = imp.pattern_next_action,
|
pattern_next_action = imp.pattern_next_action,
|
||||||
|
pattern_action = imp.pattern_action,
|
||||||
moure = imp.state_normal,
|
moure = imp.state_normal,
|
||||||
controller_input = imp.controller_input,
|
controller_input = imp.controller_input,
|
||||||
reduce_timers = imp.reduce_timers,
|
reduce_timers = imp.reduce_timers,
|
||||||
@@ -198,10 +202,12 @@ function imp.new(_hab,_x,_y)
|
|||||||
pattern_next_target = imp.pattern_next_target,
|
pattern_next_target = imp.pattern_next_target,
|
||||||
super_next_target = imp.super_next_target,
|
super_next_target = imp.super_next_target,
|
||||||
pattern_recovery = imp.pattern_recovery,
|
pattern_recovery = imp.pattern_recovery,
|
||||||
|
pattern_get_next_path = imp.pattern_get_next_path,
|
||||||
|
do_jump = imp.do_jump,
|
||||||
land = imp.land,
|
land = imp.land,
|
||||||
shot = imp.shot,
|
shot = imp.shot,
|
||||||
_moure=imp._moure, -- temporal debug
|
|
||||||
advance=imp.advance,
|
advance=imp.advance,
|
||||||
|
_moure=imp._moure, -- temporal debug
|
||||||
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -272,10 +278,14 @@ function imp:update_hit()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function imp:update_normal()
|
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)
|
-- Ajustar mood (emocions)
|
||||||
self:choose_mood()
|
--self:choose_mood()
|
||||||
|
|
||||||
-- analisis
|
-- analisis
|
||||||
self:analyze_env()
|
self:analyze_env()
|
||||||
@@ -289,10 +299,10 @@ function imp:update_normal()
|
|||||||
self:moure()
|
self:moure()
|
||||||
|
|
||||||
-- Logica per a selecció de frame
|
-- Logica per a selecció de frame
|
||||||
self:next_frame()
|
--self:next_frame()
|
||||||
|
|
||||||
-- colisions en personatges
|
-- colisions en personatges
|
||||||
self:colisions()
|
--self:colisions()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- imp.next_frame()
|
-- imp.next_frame()
|
||||||
@@ -448,13 +458,13 @@ if DEBUG_FN_NAME then print("reset_target_timer") end
|
|||||||
end
|
end
|
||||||
|
|
||||||
function imp:pattern_get_next_path()
|
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à
|
-- 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
|
-- 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.pattern = self.paths[self.pattern.target][next_path_idx]
|
||||||
self.path_point = 1
|
self.pattern_point = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function imp:create_hot_points() --OK
|
function imp:create_hot_points() --OK
|
||||||
@@ -599,8 +609,8 @@ if DEBUG_FN_NAME then print("fight") end
|
|||||||
self:load_pattern_paths()
|
self:load_pattern_paths()
|
||||||
|
|
||||||
self.target = self.hot_points[6]
|
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.shot_target = abad
|
||||||
|
|
||||||
self.mood=self.moods.chase
|
self.mood=self.moods.chase
|
||||||
|
|||||||
@@ -41,14 +41,16 @@ function imp:next_action()
|
|||||||
next_action = self.actions.shot
|
next_action = self.actions.shot
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
print("next_action= "..next_action.." == "..self.actions.no_action)
|
||||||
if next_action==self.actions.no_action then
|
if next_action==self.actions.no_action then
|
||||||
if self.move_type==self.move_types.free then
|
if self.move_type==self.move_types.free then
|
||||||
-- msg_print(10,20,"FREE",true)
|
-- msg_print(10,20,"FREE",true)
|
||||||
next_action = self:free_next_action()
|
next_action = self:free_next_action()
|
||||||
elseif self.move_type==self.move_types.pattern then
|
elseif self.move_type==self.move_types.pattern then
|
||||||
-- msg_print(10,20,"PATTERN "..self.action_event,true)
|
-- msg_print(10,20,"PATTERN "..self.action_event,true)
|
||||||
|
print("imp_action.lua -> next_action -> pattern")
|
||||||
next_action=self:pattern_next_action()
|
next_action=self:pattern_next_action()
|
||||||
|
print("imp_action.lua -> next_action -> pattern => "..next_action)
|
||||||
elseif self.move_type==self.move_types.super then
|
elseif self.move_type==self.move_types.super then
|
||||||
-- msg_print(10,20,"SUPER "..self.action_event,true)
|
-- msg_print(10,20,"SUPER "..self.action_event,true)
|
||||||
end
|
end
|
||||||
@@ -110,21 +112,23 @@ end
|
|||||||
|
|
||||||
function imp:pattern_next_action()
|
function imp:pattern_next_action()
|
||||||
if DEBUG_FN_NAME then print("pattern_next_action") end
|
if DEBUG_FN_NAME then print("pattern_next_action") end
|
||||||
|
print("self.pattern_point= ".. self.pattern_point)
|
||||||
local pattern_event = self.pattern.actions[self.pattern_point].event
|
local pattern_event = self.pattern.actions[self.pattern_point].event
|
||||||
|
print("imp_action.lua -> pattern_next_action -> "..self.action_event.."~="..pattern_event)
|
||||||
-- Si no s'ha donat l'event mantindre el moviment
|
-- Si no s'ha donat l'event mantindre el moviment
|
||||||
if self.action_event~=pattern_event then
|
if self.action_event~=pattern_event then
|
||||||
action = self.actions[self.pattern.actions[self.pattern_point].action]
|
action = self.actions[self.pattern.actions[self.pattern_point].action]
|
||||||
else
|
else
|
||||||
-- Si s'ha donat l'event avançar el punter del path
|
-- Si s'ha donat l'event avançar el punter del path
|
||||||
-- Si no queden accions carregar el següent path
|
|
||||||
if self.pattern_point<#self.pattern.actions then
|
|
||||||
self:pattern_get_next_path()
|
|
||||||
self.pattern_point = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
-- En el path
|
-- En el path
|
||||||
self.pattern_point = self.pattern_point + 1
|
self.pattern_point = self.pattern_point + 1
|
||||||
|
-- Si no queden accions carregar el següent path
|
||||||
|
print(self.pattern_point..">#"..#self.pattern.actions)
|
||||||
|
if self.pattern_point>#self.pattern.actions then
|
||||||
|
self:pattern_get_next_path()
|
||||||
|
end
|
||||||
|
|
||||||
|
print("-self.pattern_point= ".. self.pattern_point)
|
||||||
action = self:pattern_action()
|
action = self:pattern_action()
|
||||||
end
|
end
|
||||||
self.action_event = ""; -- Action_event processat
|
self.action_event = ""; -- Action_event processat
|
||||||
@@ -132,8 +136,13 @@ if DEBUG_FN_NAME then print("pattern_next_action") end
|
|||||||
end
|
end
|
||||||
|
|
||||||
function imp:pattern_action()
|
function imp:pattern_action()
|
||||||
if DEBUG_FN_NAME then print("pattern_action") end
|
if not DEBUG_FN_NAME then print("pattern_action") end
|
||||||
return self.actions[self.path.actions[self.pattern_point].action]
|
local idx = self.pattern_point
|
||||||
|
print(idx)
|
||||||
|
local pattern_action = self.pattern.actions[idx]
|
||||||
|
local curr_action = pattern_action.action
|
||||||
|
local next_action = self.actions[curr_action]
|
||||||
|
return next_action
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -66,11 +66,6 @@ function imp:pattern_recovery() -- OK
|
|||||||
return self.actions[self.path.actions[1].action]
|
return self.actions[self.path.actions[1].action]
|
||||||
end
|
end
|
||||||
|
|
||||||
function imp:pattern_next_target()
|
|
||||||
if DEBUG_FN_NAME then print("pattern_next_target") end
|
|
||||||
self.target = self.hot_points[self.path.next]
|
|
||||||
end
|
|
||||||
|
|
||||||
-------------------------------
|
-------------------------------
|
||||||
-- imp.controller_input()
|
-- imp.controller_input()
|
||||||
--
|
--
|
||||||
@@ -79,14 +74,13 @@ end
|
|||||||
function imp:controller_input()
|
function imp:controller_input()
|
||||||
if DEBUG_FN_NAME then print("controller_input") end
|
if DEBUG_FN_NAME then print("controller_input") end
|
||||||
|
|
||||||
print(self.action)
|
|
||||||
--To Do: JumpFWD
|
--To Do: JumpFWD
|
||||||
if self.action == self.actions.right or self.action == self.actions.left then
|
if self.action == self.actions.right or self.action == self.actions.left then
|
||||||
self.movement = self.action
|
self.movement = self.action
|
||||||
-- self.moure=imp.state_walking
|
-- self.moure=imp.state_walking
|
||||||
self:_moure(imp.state_walking, "state_walking (movement)")
|
self:_moure(imp.state_walking, "state_walking (movement)")
|
||||||
elseif self.action == self.actions.jump then
|
elseif self.action == self.actions.jump then
|
||||||
-- self:do_jump()
|
self:do_jump()
|
||||||
elseif self.action == "jumpfwd" then
|
elseif self.action == "jumpfwd" then
|
||||||
-- self:do_jump(true)
|
-- self:do_jump(true)
|
||||||
elseif self.action == self.actions.shot then
|
elseif self.action == self.actions.shot then
|
||||||
|
|||||||
@@ -41,3 +41,10 @@ if DEBUG_FN_NAME then print("free_next_target") end
|
|||||||
---- ... ara s'intenta tornar al moviment per patró
|
---- ... ara s'intenta tornar al moviment per patró
|
||||||
self:pattern_recovery()
|
self:pattern_recovery()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function imp:pattern_next_target()
|
||||||
|
if not DEBUG_FN_NAME then print("pattern_next_target") end
|
||||||
|
local next_target = self.hot_points[self.pattern.target]
|
||||||
|
print(next_target.id)
|
||||||
|
self.target = next_target
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user