diff --git a/sonic-radiance.love/core/input.lua b/sonic-radiance.love/core/input.lua index ee76baa..21e5f70 100644 --- a/sonic-radiance.love/core/input.lua +++ b/sonic-radiance.love/core/input.lua @@ -81,7 +81,7 @@ end -- Manage pressed keys function InputManager:flushKeys() - for i,v in ipairs(self.sources) do + for i, source in ipairs(self.sources) do source:flushKeys() end end diff --git a/sonic-radiance.love/core/modules/scenes.lua b/sonic-radiance.love/core/modules/scenes.lua index a28f18f..37481dc 100644 --- a/sonic-radiance.love/core/modules/scenes.lua +++ b/sonic-radiance.love/core/modules/scenes.lua @@ -136,16 +136,15 @@ end function Scene:setKeys() if (self.inputLocked) then - self.sources = core.input.fakesources self.inputLockedTimer = self.inputLockedTimer - 1 if (self.inputLockedTimer <= 0 ) then self.inputLocked = false end + self.menusystem.keys = self.sources[1].fakekeys else self.sources = core.input.sources + self.menusystem.keys = self.sources[1].keys end - - self.menusystem.keys = self.sources[1].keys end function Scene:getKeys(sourceid) diff --git a/sonic-radiance.love/datas/gamedata/characters/sonic/init.lua b/sonic-radiance.love/datas/gamedata/characters/sonic/init.lua index 701f0a5..3749c0a 100644 --- a/sonic-radiance.love/datas/gamedata/characters/sonic/init.lua +++ b/sonic-radiance.love/datas/gamedata/characters/sonic/init.lua @@ -4,9 +4,10 @@ return { class = "speedster", speed = 5, jump = 3, + turns = 3, startlevel = 1, - + isUnlockedAtStart = true, canGoSuper = true, canBreakCraft = false, diff --git a/sonic-radiance.love/datas/gamedata/characters/sonic/stats.lua b/sonic-radiance.love/datas/gamedata/characters/sonic/stats.lua index f40c858..e4a4b7c 100644 --- a/sonic-radiance.love/datas/gamedata/characters/sonic/stats.lua +++ b/sonic-radiance.love/datas/gamedata/characters/sonic/stats.lua @@ -8,4 +8,5 @@ return { technic = 50, -- How much items & wisps will be powerfull for this character. mind = 50, -- Magic defense. luck = 50, -- Critical hits and stuff like that. + speed = 50, -- Où le personnage se trouve dans le tour. } diff --git a/sonic-radiance.love/game/characters.lua b/sonic-radiance.love/game/characters.lua index e1e0051..73b9515 100644 --- a/sonic-radiance.love/game/characters.lua +++ b/sonic-radiance.love/game/characters.lua @@ -35,7 +35,7 @@ end function CharacterManager:init() for k, v in pairs(self.namelist) do - local dir = "datas/gamedata/characters/" .. v .. ".lua" + local dir = "datas/gamedata/characters/" .. v .. "/init.lua" local fileinfo = love.filesystem.getInfo(dir) if fileinfo ~= nil then self:initCharacter(v) @@ -45,7 +45,13 @@ end function CharacterManager:getCharacterData(charname) -- va eprmettre de récupérer les données d'un personnage - return require("datas.gamedata.characters." .. charname) + local charfolder = "datas.gamedata.characters." .. charname + local character = require(charfolder) + character.base_stats = require(charfolder .. ".stats") + character.inventory = require(charfolder .. ".inventory") + character.skills = require(charfolder .. ".skills") + + return character end function CharacterManager:initCharacter(id) @@ -63,7 +69,6 @@ function CharacterManager:initCharacter(id) stats.technic = character.base_stats.technic stats.mind = character.base_stats.mind stats.speed = character.base_stats.speed - stats.turns = character.base_stats.turns character.stats = stats self.list[id] = character @@ -131,7 +136,7 @@ function CharacterManager:getSkillList(id) local character = self.list[id] local learnedlist = {} - for i, v in ipairs(character.skill_list) do + for i, v in ipairs(character.skills) do local tech_name, tech_level, isLearned = v[1], v[2], false if tech_level <= character.stats.level then diff --git a/sonic-radiance.love/main.lua b/sonic-radiance.love/main.lua index 83c5003..f3e47c7 100644 --- a/sonic-radiance.love/main.lua +++ b/sonic-radiance.love/main.lua @@ -30,7 +30,7 @@ function love.load() core = Core(true) game = Game() - scenes.test() + scenes.cbs() end function love.update(dt) diff --git a/sonic-radiance.love/scenes/battlesystem/controller/cursor.lua b/sonic-radiance.love/scenes/battlesystem/controller/cursor.lua index aa656fb..37154b0 100644 --- a/sonic-radiance.love/scenes/battlesystem/controller/cursor.lua +++ b/sonic-radiance.love/scenes/battlesystem/controller/cursor.lua @@ -101,7 +101,7 @@ function Cursor:update(dt) if (self.frame >= 4) then self.frame = 1 end - local keys = self.controller.keys + local keys = self.controller.sources[1].keys if (keys["up"].isPressed) then dy = math.max(self.y - 1, 1) diff --git a/sonic-radiance.love/scenes/battlesystem/entities/character.lua b/sonic-radiance.love/scenes/battlesystem/entities/character.lua index 81cc783..0b58790 100644 --- a/sonic-radiance.love/scenes/battlesystem/entities/character.lua +++ b/sonic-radiance.love/scenes/battlesystem/entities/character.lua @@ -14,8 +14,8 @@ function Character:new(controller, x, y, charid) err("FATAL ERROR: charid not set") end self.charid = charid - self.actionPerTurn = game.characters.list[self.charid].base_stats.turns - self.assets:addSprite(charid, "assets/sprites/characters/" .. charid) + self.actionPerTurn = game.characters.list[self.charid].turns + self.assets:addSprite(charid, "datas/gamedata/characters/" .. charid .. "/sprites") self.assets.sprites[self.charid]:setCustomSpeed(16) self:setAnimation("idle") self:setSprite(charid, 32, 48, true) @@ -41,6 +41,10 @@ end function Character:setActive() local gridsize = game.characters.list[self.charid].base_stats.move + if (gridsize == nil) then + gridsize = 3 + core.debug:warning("cbs/character", "move value is nil") + end self.controller.cursor:setGrid("square", self.x, self.y, gridsize, self) self.startx, self.starty = self.x, self.y self.controller.cursor:set(self.startx, self.starty) @@ -50,6 +54,7 @@ function Character:setActive() end function Character:update(dt) + self.keys = self.controller.sources[1].keys if (self.currentAction == "moving") then self.xprevious = self.x self.yprevious = self.y @@ -74,7 +79,7 @@ function Character:update(dt) end elseif (self.currentAction == "selectAttack") then - if (self.controller.keys["B"].isPressed) then + if (self.keys["B"].isPressed) then --self.currentAction = "selectDirection" --self.controller.cursor:set(self.x, self.y) end