Skip to content

Commit

Permalink
fix save data issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MondayHopscotch committed Aug 15, 2023
1 parent 170bae8 commit 0d46993
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions source/progress/Collected.hx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Collected {
public static function gameComplete() {
clearCheckpoint();
clearUnlocks();
FlxG.save.data.game.gameComplete = true;
FlxG.save.data.game.gameCompleted = true;
FlxG.save.flush();
}

Expand All @@ -115,12 +115,17 @@ class Collected {
lastEntityID: null,
time: 0.0,
deaths: 0,
safeReturn: false,
};
FlxG.save.flush();
}

static function clearUnlocks() {
FlxG.save.data.game.checkpoint = null;
FlxG.save.data.game.unlocks = {
blueUnlocked: false,
yellowUnlocked: false,
redUnlocked: false,
};
FlxG.save.flush();
}

Expand Down
4 changes: 4 additions & 0 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,10 @@ class PlayState extends FlxTransitionableState {
if (FlxG.keys.justPressed.N) {
Collected.enableSafeReturn();
}

if (FlxG.keys.justPressed.J) {
Collected.gameComplete();
}
#end

resetQueued = false;
Expand Down

0 comments on commit 0d46993

Please sign in to comment.