Fixed critical oversight in timer management and implimented global timer system

This commit is contained in:
Jojackman1
2026-01-24 19:21:26 -07:00
parent f1ab5a352c
commit d806c69fb0
6 changed files with 50 additions and 159 deletions

View File

@@ -6,6 +6,11 @@ public partial class CommonData : Node
{
public bool Muted = true;
// Game Information
public const float FPS = 90.0f; // Max game fps
public float GlobalTimer = 0.0f; // Seconds elapsed since game start
int NumFramesElapsed = 0;
// Level information
public string CurrentLevel;
@@ -38,6 +43,11 @@ public partial class CommonData : Node
public override void _Process(double delta)
{
// Frame Counter
NumFramesElapsed += 1;
GlobalTimer = NumFramesElapsed / FPS;
GlobalTimer = (float)Convert.ToDouble(GlobalTimer.ToString("0.##")); // Truncates seconds elapsed to hundreds place (0.00)
if (Input.IsActionJustPressed("quit_game"))
{
GetTree().Quit();