diff --git a/sonic-radiance.love/assets/sfx/badnicsDestroyed.wav b/sonic-radiance.love/assets/sfx/badnicsDestroyed.wav new file mode 100644 index 0000000..57c72ca Binary files /dev/null and b/sonic-radiance.love/assets/sfx/badnicsDestroyed.wav differ diff --git a/sonic-radiance.love/assets/sprites/gfx/boom1.lua b/sonic-radiance.love/assets/sprites/gfx/boom1.lua new file mode 100644 index 0000000..d9ec909 --- /dev/null +++ b/sonic-radiance.love/assets/sprites/gfx/boom1.lua @@ -0,0 +1,18 @@ +return { + metadata = { + height = 32, + width = 32, + defaultAnim = "default", + ox = 16, + oy = 32, + }, + animations = { + ["default"] = { + startAt = 1, + endAt = 3, + loop = 1, + speed = 15, + pauseAtEnd = false, + }, + } +} diff --git a/sonic-radiance.love/assets/sprites/gfx/boom1.png b/sonic-radiance.love/assets/sprites/gfx/boom1.png new file mode 100644 index 0000000..40fe6a1 Binary files /dev/null and b/sonic-radiance.love/assets/sprites/gfx/boom1.png differ diff --git a/sonic-radiance.love/datas/gamedata/characters/amy/sprites.lua b/sonic-radiance.love/datas/gamedata/characters/amy/sprites.lua index 86a1210..89a8e56 100644 --- a/sonic-radiance.love/datas/gamedata/characters/amy/sprites.lua +++ b/sonic-radiance.love/datas/gamedata/characters/amy/sprites.lua @@ -112,5 +112,19 @@ return { speed = 25, pauseAtEnd = false, }, + ["hurt"] = { + startAt = 47, + endAt = 49, + loop = 49, + speed = 15, + pauseAtEnd = true, + }, + ["ko"] = { + startAt = 50, + endAt = 52, + loop = 52, + speed = 15, + pauseAtEnd = true, + } } } diff --git a/sonic-radiance.love/datas/gamedata/characters/amy/sprites.png b/sonic-radiance.love/datas/gamedata/characters/amy/sprites.png index dd2fb18..221fa43 100644 Binary files a/sonic-radiance.love/datas/gamedata/characters/amy/sprites.png and b/sonic-radiance.love/datas/gamedata/characters/amy/sprites.png differ diff --git a/sonic-radiance.love/datas/gamedata/characters/sonic/sprites.lua b/sonic-radiance.love/datas/gamedata/characters/sonic/sprites.lua index b847e83..479d4d0 100644 --- a/sonic-radiance.love/datas/gamedata/characters/sonic/sprites.lua +++ b/sonic-radiance.love/datas/gamedata/characters/sonic/sprites.lua @@ -112,5 +112,19 @@ return { speed = 25, pauseAtEnd = false, }, + ["hurt"] = { + startAt = 55, + endAt = 57, + loop = 57, + speed = 15, + pauseAtEnd = true, + }, + ["ko"] = { + startAt = 58, + endAt = 62, + loop = 62, + speed = 15, + pauseAtEnd = true, + } } } diff --git a/sonic-radiance.love/datas/gamedata/characters/sonic/sprites.png b/sonic-radiance.love/datas/gamedata/characters/sonic/sprites.png index 9135f4e..02da380 100644 Binary files a/sonic-radiance.love/datas/gamedata/characters/sonic/sprites.png and b/sonic-radiance.love/datas/gamedata/characters/sonic/sprites.png differ diff --git a/sonic-radiance.love/datas/gamedata/characters/tails/sprites.lua b/sonic-radiance.love/datas/gamedata/characters/tails/sprites.lua index ac190cd..c275b7f 100644 --- a/sonic-radiance.love/datas/gamedata/characters/tails/sprites.lua +++ b/sonic-radiance.love/datas/gamedata/characters/tails/sprites.lua @@ -112,5 +112,19 @@ return { speed = 25, pauseAtEnd = false, }, + ["hurt"] = { + startAt = 49, + endAt = 51, + loop = 51, + speed = 15, + pauseAtEnd = true, + }, + ["ko"] = { + startAt = 53, + endAt = 59, + loop = 59, + speed = 15, + pauseAtEnd = true, + } } } diff --git a/sonic-radiance.love/datas/gamedata/characters/tails/sprites.png b/sonic-radiance.love/datas/gamedata/characters/tails/sprites.png index 6428e76..6e67e13 100644 Binary files a/sonic-radiance.love/datas/gamedata/characters/tails/sprites.png and b/sonic-radiance.love/datas/gamedata/characters/tails/sprites.png differ diff --git a/sonic-radiance.love/game/abstractmobs/parent.lua b/sonic-radiance.love/game/abstractmobs/parent.lua index c9134ab..10fd8be 100644 --- a/sonic-radiance.love/game/abstractmobs/parent.lua +++ b/sonic-radiance.love/game/abstractmobs/parent.lua @@ -47,6 +47,7 @@ function AbstractMobParent:setHP(newHP, relative) else self.hp = newHP end + self.hp = math.max(0, self.hp) end function AbstractMobParent:setPP(newPP, relative) diff --git a/sonic-radiance.love/scenes/battlesystem/actors/battler.lua b/sonic-radiance.love/scenes/battlesystem/actors/battler.lua index 3cedfdb..bef1e9c 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/battler.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/battler.lua @@ -228,6 +228,14 @@ function Battler:choregraphyEnded() self.movementType = MOVEMENT_NONE end +function Battler:getHurt() + +end + +function Battler:die() + self:destroy() +end + -- DRAW FUNCTIONS function Battler:draw() local x, y = self.world.map:gridToPixel(self.x, self.y, true) @@ -250,6 +258,11 @@ function Battler:animationEnded(animation) if (self.currentlyBlocking ~= nil and self.blockedBy=="animation") then self:unblockChoregraphy() end + self:getNewAnimation(animation) +end + +function Battler:getNewAnimation(animation) + end function Battler:validateAction() diff --git a/sonic-radiance.love/scenes/battlesystem/actors/ennemy.lua b/sonic-radiance.love/scenes/battlesystem/actors/ennemy.lua index 0a2157a..33c4d71 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/ennemy.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/ennemy.lua @@ -23,6 +23,12 @@ function Ennemy:draw() end end +function Ennemy:die() + self.assets.sfx["badnicsBoom"]:play() + self.world.obj.GFX(self.world, self.x, self.y, self.z, "boomGFX", self, false) + self:destroy() +end + function Ennemy:getStats() return self.data.stats end diff --git a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua index 514910b..b804d2d 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua @@ -17,6 +17,16 @@ function Hero:update(dt) self:updateAnimation(dt) end +-- HURT/DEATH FUNCTIONS + +function Hero:getHurt() + self:changeAnimation("hurt") +end + +function Hero:die() + self:changeAnimation("ko") +end + -- ASSETS FUNCTIONS -- Load and play assets needed by the character @@ -36,6 +46,12 @@ function Hero:updateAnimation(dt) self:setCustomSpeed(self.gspeed * 160 * dt) end +function Hero:getNewAnimation(animation) + if (animation == "hurt") then + self:changeAnimation("idle") + end +end + -- DRAW FUNCTIONS -- Draw everything related to the hero diff --git a/sonic-radiance.love/scenes/battlesystem/assets.lua b/sonic-radiance.love/scenes/battlesystem/assets.lua index 94dd0d1..b4259fb 100644 --- a/sonic-radiance.love/scenes/battlesystem/assets.lua +++ b/sonic-radiance.love/scenes/battlesystem/assets.lua @@ -8,6 +8,7 @@ return { ["sprites"] = { {"cursorground", "assets/gui/cursor/ground"}, {"hitGFX", "assets/sprites/gfx/hit"}, + {"boomGFX", "assets/sprites/gfx/boom1"}, }, ["textures"] = { {"menucursor", "assets/gui/cursor-menulist.png"}, @@ -43,6 +44,7 @@ return { {"woosh", "assets/sfx/woosh.wav"}, {"spincharge", "assets/sfx/spincharge.wav"}, {"spinrelease", "assets/sfx/spinrelease.wav"}, + {"badnicsBoom", "assets/sfx/badnicsDestroyed.wav"}, {"mBack", "assets/sfx/menus/back.wav"}, {"mBeep", "assets/sfx/menus/beep.wav"}, diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua index cfa69c8..be72284 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua @@ -40,6 +40,7 @@ end function FighterParent:die() self.isAlive = false + self.actor:die() end function FighterParent:sendDamage(target, value, accuracy, isSpecial, isAerial) @@ -68,6 +69,7 @@ function FighterParent:receiveDamage(value, accuracy, isSpecial, isAerial) core.debug:print("cbs/fighter", "Taken " .. value .. " damage" ) self:setHP(value * -1, true) + self.actor:getHurt() end function FighterParent:getAbstract() diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/villain.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/villain.lua index b25dc4e..4f78249 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/villain.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/villain.lua @@ -72,11 +72,6 @@ function VillainFighter:endAction() end -function FighterParent:die() - self.isAlive = false - self.actor:destroy() -end - function VillainFighter:setBonus(pvFactor, statFactor) self.abstract:setBonus(pvFactor, statFactor) end diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/init.lua b/sonic-radiance.love/scenes/battlesystem/controllers/init.lua index d590c26..fc7ae5b 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/init.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/init.lua @@ -50,7 +50,9 @@ function TurnController:update(dt) if (self.currentFighter ~= nil) then self.currentFighter:update(dt) else - self:nextAction() + if (self.player:countAlive() > 0) then + self:nextAction() + end end end end