diff --git a/sonic-radiance.love/game/modules/subgames/world/actors/fighters/init.lua b/sonic-radiance.love/game/modules/subgames/world/actors/fighters/init.lua deleted file mode 100644 index 9552408..0000000 --- a/sonic-radiance.love/game/modules/subgames/world/actors/fighters/init.lua +++ /dev/null @@ -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 diff --git a/sonic-radiance.love/game/modules/subgames/world/actors/fighters/actions.lua b/sonic-radiance.love/game/modules/subgames/world/actors/fighters/mixins/actions.lua similarity index 100% rename from sonic-radiance.love/game/modules/subgames/world/actors/fighters/actions.lua rename to sonic-radiance.love/game/modules/subgames/world/actors/fighters/mixins/actions.lua diff --git a/sonic-radiance.love/game/modules/subgames/world/actors/fighters/movements.lua b/sonic-radiance.love/game/modules/subgames/world/actors/fighters/mixins/movements.lua similarity index 100% rename from sonic-radiance.love/game/modules/subgames/world/actors/fighters/movements.lua rename to sonic-radiance.love/game/modules/subgames/world/actors/fighters/mixins/movements.lua diff --git a/sonic-radiance.love/game/modules/subgames/world/actors/fighters/parent.lua b/sonic-radiance.love/game/modules/subgames/world/actors/fighters/parent.lua new file mode 100644 index 0000000..4c8facf --- /dev/null +++ b/sonic-radiance.love/game/modules/subgames/world/actors/fighters/parent.lua @@ -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 diff --git a/sonic-radiance.love/game/modules/subgames/world/actors/fighters/controls.lua b/sonic-radiance.love/game/modules/subgames/world/actors/fighters/player/controls.lua similarity index 100% rename from sonic-radiance.love/game/modules/subgames/world/actors/fighters/controls.lua rename to sonic-radiance.love/game/modules/subgames/world/actors/fighters/player/controls.lua diff --git a/sonic-radiance.love/game/modules/subgames/world/actors/fighters/player/init.lua b/sonic-radiance.love/game/modules/subgames/world/actors/fighters/player/init.lua new file mode 100644 index 0000000..2b805ab --- /dev/null +++ b/sonic-radiance.love/game/modules/subgames/world/actors/fighters/player/init.lua @@ -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 diff --git a/sonic-radiance.love/game/modules/subgames/world/actors/fighters/score.lua b/sonic-radiance.love/game/modules/subgames/world/actors/fighters/player/score.lua similarity index 100% rename from sonic-radiance.love/game/modules/subgames/world/actors/fighters/score.lua rename to sonic-radiance.love/game/modules/subgames/world/actors/fighters/player/score.lua diff --git a/sonic-radiance.love/game/modules/subgames/world/actors/fighters/sprites.lua b/sonic-radiance.love/game/modules/subgames/world/actors/fighters/player/sprites.lua similarity index 100% rename from sonic-radiance.love/game/modules/subgames/world/actors/fighters/sprites.lua rename to sonic-radiance.love/game/modules/subgames/world/actors/fighters/player/sprites.lua diff --git a/sonic-radiance.love/game/modules/subgames/world/actors/init.lua b/sonic-radiance.love/game/modules/subgames/world/actors/init.lua index fea28f9..484af22 100644 --- a/sonic-radiance.love/game/modules/subgames/world/actors/init.lua +++ b/sonic-radiance.love/game/modules/subgames/world/actors/init.lua @@ -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 = {}