WIP: new-cbs #117

Closed
kazhnuz wants to merge 23 commits from new-cbs into master
9 changed files with 86 additions and 74 deletions
Showing only changes of commit 4d22e35288 - Show all commits

View file

@ -1,73 +0,0 @@
local cwd = (...):gsub('%.player$', '') .. "."
local Parent = require(cwd .. "parent")
local Player = Parent:extend()
local TweenManager = require "birb.classes.time"
local Actions = require "game.modules.subgames.world.actors.player.actions"
local Movements = require "game.modules.subgames.world.actors.player.movements"
local Score = require "game.modules.subgames.world.actors.player.score"
local Sprites = require "game.modules.subgames.world.actors.player.sprites"
local Controls = require "game.modules.subgames.world.actors.player.controls"
local Team = require "scenes.overworld.actors.player.team"
Player:implement(Actions)
Player:implement(Movements)
Player:implement(Score)
Player:implement(Sprites)
Player:implement(Team)
Player:implement(Controls)
function Player:new(world, x, y, z, id)
Player.super.new(self, world, "player", x, y, 0, 16, 12, 24, true)
self:initMovements()
self:initCharactersSprites()
self:initScore()
self:initActions()
self:initTeam()
self.tweens = TweenManager(self)
end
function Player:updateStart(dt)
self:applyInputs()
end
function Player:update(dt)
self:updateMovements(dt)
Player.super.update(self, dt)
self.tweens:update(dt)
end
function Player:collisionResponse(collision)
if collision.other.type == "collectible" then
collision.other.owner:getPicked(self)
end
end
function Player:timerResponse(response)
if (response == "changeCharacter") then
self:endCharacterSwitchAnimation()
end
end
function Player:animationEnded(name)
end
function Player:updateEnd(dt)
self:setAnimation()
end
function Player:getViewCenter()
local x, y = Player.super.getViewCenter(self)
return x, y-16
end
function Player:draw()
Player.super.draw(self)
end
return Player

View file

@ -0,0 +1,34 @@
local Parent = require("game.modules.subgames.world.actors.parent")
local FighterParent = Parent:extend()
local TweenManager = require "birb.classes.time"
local Actions = require "game.modules.subgames.world.actors.fighters.mixins.actions"
local Movements = require "game.modules.subgames.world.actors.fighters.mixins.movements"
FighterParent:implement(Actions)
FighterParent:implement(Movements)
FighterParent:implement(Score)
FighterParent:implement(Sprites)
FighterParent:implement(Team)
FighterParent:implement(Controls)
function FighterParent:new(world, x, y, w, h, d, fighterType)
FighterParent.super.new(self, world, fighterType, x, y, 0, w, h, d, true)
self:initMovements()
self:initActions()
self.tweens = TweenManager(self)
end
function FighterParent:update(dt)
self:updateMovements(dt)
FighterParent.super.update(self, dt)
self.tweens:update(dt)
end
function FighterParent:animationEnded(name)
end
return FighterParent

View file

@ -0,0 +1,51 @@
local Parent = require("game.modules.subgames.world.actors.fighters.parent")
local Player = Parent:extend()
local Score = require "game.modules.subgames.world.actors.fighters.player.score"
local Sprites = require "game.modules.subgames.world.actors.fighters.player.sprites"
local Controls = require "game.modules.subgames.world.actors.fighters.player.controls"
local Team = require "scenes.overworld.actors.player.team"
Player:implement(Score)
Player:implement(Sprites)
Player:implement(Team)
Player:implement(Controls)
function Player:new(world, x, y, z, id)
Player.super.new(self, world, x, y, 16, 12, 24, "fighter")
self:initCharactersSprites()
self:initScore()
self:initTeam()
end
function Player:updateStart(dt)
self:applyInputs()
end
function Player:collisionResponse(collision)
if collision.other.type == "collectible" then
collision.other.owner:getPicked(self)
end
end
function Player:timerResponse(response)
if (response == "changeCharacter") then
self:endCharacterSwitchAnimation()
end
end
function Player:animationEnded(name)
end
function Player:updateEnd(dt)
self:setAnimation()
end
function Player:getViewCenter()
local x, y = Player.super.getViewCenter(self)
return x, y-16
end
return Player

View file

@ -2,7 +2,7 @@ local Obj = {}
-- On charge toutes les différentes types d'acteurs
local cwd = (...):gsub('%.init$', '') .. "."
Obj.Player = require(cwd .. "player")
Obj.Player = require(cwd .. "fighters.player")
Obj.Ring = require(cwd .. "items.ring")
Obj.index = {}