Save game on level start if enabled

This commit is contained in:
Marco 2025-04-02 18:39:37 +02:00
commit 3d4ed2a1fd
2 changed files with 7 additions and 2 deletions

View file

@ -69,6 +69,11 @@ public partial class GameManager : Node2D
{ {
Instance = this; Instance = this;
if (GlobalState.Instance.SessionSettings.AllowSaving)
{
GlobalState.Instance.SaveGame();
}
_hud = GetNodeOrNull<Hud>("HUD"); _hud = GetNodeOrNull<Hud>("HUD");
if (_hud == null) GD.Print("No HUD in scene."); if (_hud == null) GD.Print("No HUD in scene.");
@ -189,10 +194,8 @@ public partial class GameManager : Node2D
_player.Owner = this; _player.Owner = this;
} }
_player.Transform = this.GlobalTransform; _player.Transform = this.GlobalTransform;
_player.GlobalPosition = GetStartPosition(); _player.GlobalPosition = GetStartPosition();
LastCheckpointPosition = _player.GlobalPosition; LastCheckpointPosition = _player.GlobalPosition;

View file

@ -8,6 +8,8 @@ public class SessionSettings
public bool SkipDialogues { get; set; } = false; public bool SkipDialogues { get; set; } = false;
public bool GodMode { get; set; } = false; public bool GodMode { get; set; } = false;
public bool AllowSaving { get; set; } = false;
public Godot.Collections.Dictionary<string, int> Items { get; set; } = new(); public Godot.Collections.Dictionary<string, int> Items { get; set; } = new();
public int LevelNumber { get; set; } = 0; public int LevelNumber { get; set; } = 0;