From 0cd282027c5c437362850e3955c1c2a20276bb9c Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Fri, 2 Apr 2021 22:25:26 +0200 Subject: [PATCH] improvement: use the cbs functions to unload cbs --- sonic-radiance.love/scenes/battlesystem/init.lua | 8 ++++++-- .../scenes/battlesystem/screens/victory.lua | 3 +-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sonic-radiance.love/scenes/battlesystem/init.lua b/sonic-radiance.love/scenes/battlesystem/init.lua index 2fe636d..c46b22c 100644 --- a/sonic-radiance.love/scenes/battlesystem/init.lua +++ b/sonic-radiance.love/scenes/battlesystem/init.lua @@ -56,11 +56,15 @@ end function BattleSystem:timerResponse(name) if (name == "flee") then - --placeholder, pour l'instant on retourne juste au menu - scenes.debug.menu() + self:returnToOverworld(true) end end +function BattleSystem:returnToOverworld(isFleeing) + self.assets:silence() + game.cbs:endBattle(isFleeing) +end + function BattleSystem:looseBattle() self.screen = GameOverScreen(self) end diff --git a/sonic-radiance.love/scenes/battlesystem/screens/victory.lua b/sonic-radiance.love/scenes/battlesystem/screens/victory.lua index 28ab2da..a2ed706 100644 --- a/sonic-radiance.love/scenes/battlesystem/screens/victory.lua +++ b/sonic-radiance.love/scenes/battlesystem/screens/victory.lua @@ -114,8 +114,7 @@ function VictoryScreen:update(dt) if (self:allCharDone()) then local keys = self.scene:getKeys(1) if (keys["A"].isPressed) then - --placeholder, pour l'instant on retourne juste au menu - scenes.debug.menu() + self.scene:returnToOverworld(false) end end