Skip to content

Commit

Permalink
Patched a minor bug with 7s auto-exit timer
Browse files Browse the repository at this point in the history
  • Loading branch information
Tetro48 committed Mar 24, 2024
1 parent cd1a212 commit 3ba72ae
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scene/game.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ function GameScene:update()
})
if self.game.game_over or self.game.completed then
self.game_over_frames = self.game_over_frames + 1
if self.game_over_frames > 420 then
if self.game_over_frames > 420 and not self.is_exiting then
local highscore_entry = self.game:getHighscoreData()
local highscore_hash = self.game.hash .. "-" .. self.ruleset.hash
submitHighscore(highscore_hash, highscore_entry)
switchBGM(nil)
self.game:onExit()
self.is_exiting = true
scene = ContinueScene()
end
end
Expand Down Expand Up @@ -103,7 +109,7 @@ local opposite_directions = {left = "right", right = "left", up = "down", down =

function GameScene:onInputPress(e)
if (
self.game.game_over or self.game.completed
self.game.game_over or self.game.completed and not self.is_exiting
) and (
e.input == "menu_decide" or
e.input == "menu_back" or
Expand All @@ -115,6 +121,7 @@ function GameScene:onInputPress(e)
submitHighscore(highscore_hash, highscore_entry)
switchBGM(nil)
self.game:onExit()
self.is_exiting = true
sortReplays()
scene = ContinueScene()
scene.safety_frames = 2
Expand Down

0 comments on commit 3ba72ae

Please sign in to comment.