[WIP] Treballant en el jefe. Separat el 'motor' de moviment per patró

This commit is contained in:
2026-04-14 23:41:34 +02:00
parent d477988d10
commit 0c9c31dca2
4 changed files with 234 additions and 56 deletions

View File

@@ -110,29 +110,44 @@ if DEBUG_FN_NAME then print("free_next_action") end
return action
end
-- function imp:pattern_next_action()
-- 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
-- print("imp_action.lua -> pattern_next_action -> "..self.action_event.."~="..pattern_event)
-- -- Si no s'ha donat l'event mantindre el moviment
-- if self.action_event~=pattern_event then
-- action = self.actions[self.pattern.actions[self.pattern_point].action]
-- else
-- -- Si s'ha donat l'event avançar el punter del path
-- -- En el path
-- 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()
-- end
-- self.action_event = ""; -- Action_event processat
-- return action
-- end
function imp:pattern_next_action()
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
print("imp_action.lua -> pattern_next_action -> "..self.action_event.."~="..pattern_event)
local pattern_event = self.pattern:event()
print("imp_action.lua -> pattern_next_action -> "..self.action_event.."~="..self.pattern:event())
-- Si no s'ha donat l'event mantindre el moviment
if self.action_event~=pattern_event then
action = self.actions[self.pattern.actions[self.pattern_point].action]
if self.action_event~=self.pattern:event() then
action = self.pattern:action()
else
-- Si s'ha donat l'event avançar el punter del path
-- En el path
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()
-- Següent acció
action = self.pattern:next_action()
end
self.action_event = ""; -- Action_event processat
return action
return self.actions[action]
end
function imp:pattern_action()