diff --git a/Scripts/Globals.cs b/Scripts/Globals.cs index ac0667d..7e157f8 100644 --- a/Scripts/Globals.cs +++ b/Scripts/Globals.cs @@ -6,6 +6,8 @@ public partial class Globals : Node { public static string AccessLevel = ""; public static bool VersionChecked = false; + public static float MovementSpeed = 800f; + public static int Score = 0; public static int HighScore = 0; } diff --git a/Scripts/Player.cs b/Scripts/Player.cs index d0f4cd2..35b6426 100644 --- a/Scripts/Player.cs +++ b/Scripts/Player.cs @@ -2,7 +2,6 @@ using Godot; using System; public partial class Player : Node2D { - private float MovementSpeed = 800f; private float ScreenBorders = 120f; public override void _Ready() { @@ -19,13 +18,13 @@ public partial class Player : Node2D { if ((Input.IsKeyPressed((Key)Key.Left) || Input.IsKeyPressed((Key)Key.A)) && Pos.X > ScreenBorders) { GetNode("Texture").FlipH = false; - Pos.X -= MovementSpeed * (float)delta; + Pos.X -= Globals.MovementSpeed * (float)delta; } float ScreenWidth = (WindowSize.X / WindowScale.X) - ScreenBorders; if ((Input.IsKeyPressed((Key)Key.Right) || Input.IsKeyPressed((Key)Key.D)) && Pos.X < ScreenWidth) { GetNode("Texture").FlipH = true; - Pos.X += MovementSpeed * (float)delta; + Pos.X += Globals.MovementSpeed * (float)delta; } Position = Pos;