improvement: handle better defeated fighter turns
This commit is contained in:
parent
4ab2e72231
commit
d40112ba31
4 changed files with 22 additions and 12 deletions
|
@ -62,7 +62,6 @@ function TurnController:nextAction()
|
||||||
self.turns.current = self.turns.current + 1
|
self.turns.current = self.turns.current + 1
|
||||||
core.debug:print("cbs/turns", "switching to next action")
|
core.debug:print("cbs/turns", "switching to next action")
|
||||||
end
|
end
|
||||||
self.hud:moveBattleCursor(self.turns.current)
|
|
||||||
|
|
||||||
self:startAction()
|
self:startAction()
|
||||||
end
|
end
|
||||||
|
@ -101,13 +100,14 @@ function TurnController:startAction()
|
||||||
local nextAction = self.actionList[self.turns.current]
|
local nextAction = self.actionList[self.turns.current]
|
||||||
print(nextAction)
|
print(nextAction)
|
||||||
local nextFighter = nextAction.fighter
|
local nextFighter = nextAction.fighter
|
||||||
if (nextFighter.isDestroyed == true) then
|
if (not nextFighter:canFight()) then
|
||||||
-- On skipe le personnage s'il a été detruit
|
-- On skipe le personnage s'il a été detruit
|
||||||
self:nextAction()
|
self:nextAction()
|
||||||
else
|
else
|
||||||
self.currentFighter = nextFighter
|
self.currentFighter = nextFighter
|
||||||
core.debug:print("cbs/turns", "Activating " .. self.currentFighter.name)
|
core.debug:print("cbs/turns", "Activating " .. self.currentFighter.name)
|
||||||
self.currentFighter:setActive()
|
self.currentFighter:setActive()
|
||||||
|
self.hud:moveBattleCursor(self.turns.current)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -42,13 +42,11 @@ end
|
||||||
function FighterControllerParent:putActions(actionList)
|
function FighterControllerParent:putActions(actionList)
|
||||||
for i, fighter in ipairs(self.list) do
|
for i, fighter in ipairs(self.list) do
|
||||||
|
|
||||||
if fighter:canFight() then
|
for i=1, fighter:getNbrActionPerTurn() do
|
||||||
for i=1, fighter:getNbrActionPerTurn() do
|
local action = {}
|
||||||
local action = {}
|
action.fighter = fighter
|
||||||
action.fighter = fighter
|
action.number = i
|
||||||
action.number = i
|
table.insert(actionList, action)
|
||||||
table.insert(actionList, action)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -39,7 +39,11 @@ end
|
||||||
|
|
||||||
function HUD:draw()
|
function HUD:draw()
|
||||||
for i, action in ipairs(self.turns.actionList) do
|
for i, action in ipairs(self.turns.actionList) do
|
||||||
action.fighter:drawIcon(4 + (i-1)*(20), 6)
|
if action.fighter:canFight() then
|
||||||
|
action.fighter:drawIcon(4 + (i-1)*(20), 6)
|
||||||
|
else
|
||||||
|
self:drawEmptyIcon(4 + (i-1)*(20), 6)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local cursorx = self.battlerCursor * 20 - 8
|
local cursorx = self.battlerCursor * 20 - 8
|
||||||
|
|
||||||
|
@ -59,4 +63,12 @@ function HUD:draw()
|
||||||
love.graphics.print(turnnbr, x + 33, y + 1)
|
love.graphics.print(turnnbr, x + 33, y + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function HUD:drawEmptyIcon(x, y)
|
||||||
|
local outlineLight = 0.15
|
||||||
|
love.graphics.circle("fill", x + 8, y + 8, 2, 8)
|
||||||
|
love.graphics.setColor(outlineLight, outlineLight, outlineLight, 1)
|
||||||
|
love.graphics.circle("line", x + 8, y + 8, 2, 8)
|
||||||
|
utils.graphics.resetColor()
|
||||||
|
end
|
||||||
|
|
||||||
return HUD
|
return HUD
|
||||||
|
|
|
@ -13,8 +13,8 @@ function BattleSystem:new()
|
||||||
|
|
||||||
self.assets:batchImport("scenes.battlesystem.assets")
|
self.assets:batchImport("scenes.battlesystem.assets")
|
||||||
|
|
||||||
self.assets:setMusic("assets/music/battle1.mp3")
|
--self.assets:setMusic("assets/music/battle1.mp3")
|
||||||
self.assets:playMusic()
|
--self.assets:playMusic()
|
||||||
|
|
||||||
self:initManagers()
|
self:initManagers()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue