WIP: new-cbs #117

Closed
kazhnuz wants to merge 23 commits from new-cbs into master
2 changed files with 16 additions and 8 deletions
Showing only changes of commit f5bff3e1b9 - Show all commits

View file

@ -158,13 +158,16 @@ function PlayerActions:endFly()
end
function PlayerActions:actionSwitch()
if self.keys["select"].isPressed and (self.currentAction == "idle") then
if self.keys["L1"].isPressed and (self.currentAction == "idle") then
self:switchActiveCharacter()
end
if self.keys["R1"].isPressed and (self.currentAction == "idle") then
self:switchActiveCharacter(-1)
end
end
function PlayerActions:actionRun()
if self.keys["C"].isPressed then
if self.keys["X"].isPressed then
if (self:canDoAction("run") and self.speedFactor > 0) then
self.dashJustStarted = true
if (utils.table.contain({"run", "idle"}, self.currentAction)) then
@ -174,7 +177,7 @@ function PlayerActions:actionRun()
end
self.xsp, self.ysp = self:getDash()
end
elseif (not self.keys["C"].isDown) then
elseif (not self.keys["X"].isDown) then
if (self.currentAction == "run") then
self.currentAction = "idle"
elseif (self.currentAction == "jumpdash") then

View file

@ -1,8 +1,13 @@
local Team = Object:extend()
function Team:initTeam()
function Team:initTeam(forceCanGameOver)
self.active = game.characters:getActiveCharacterData()
self.canChangeActive = true
if (forceCanKO == true) then
self.canKO = true
else
self.canKO = game.difficulty:get("playerKoChar") == false
end
end
function Team:updateActiveCharacter()
@ -16,7 +21,7 @@ function Team:updateActiveCharacter()
if (everybodyIsKo) then
self.scene:gameover()
else
if ((self.active.hp == 0) and not game.difficulty:get("playerKoChar")) then
if ((self.active.hp == 0) and self.canKO) then
self:switchActiveCharacter()
end
end
@ -26,9 +31,9 @@ function Team:getCurrentCharType()
return self.active.data.class
end
function Team:switchActiveCharacter()
if (self.canChangeActive) then
local count = game.characters:setActiveCharacter()
function Team:switchActiveCharacter(direction)
if (self.canChangeActive and self.scene.gui:getElement("teamEmblems") ~= nil) then
local count = game.characters:setActiveCharacter(direction)
self.active = game.characters:getActiveCharacterData()
self.canChangeActive = false
self.tweens:newTimer(0.3, "changeCharacter")