diff --git a/Images/flair_disabled_cross.png b/Images/flair_disabled_cross.png new file mode 100644 index 0000000..064807f Binary files /dev/null and b/Images/flair_disabled_cross.png differ diff --git a/Images/flair_disabled_cross.png.import b/Images/flair_disabled_cross.png.import new file mode 100644 index 0000000..735514f --- /dev/null +++ b/Images/flair_disabled_cross.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b3ucjch8b7rve" +path="res://.godot/imported/flair_disabled_cross.png-3df80847240f401e9a98a70fda1aee83.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Images/flair_disabled_cross.png" +dest_files=["res://.godot/imported/flair_disabled_cross.png-3df80847240f401e9a98a70fda1aee83.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Scenes/SpaceShooter.tscn b/Scenes/SpaceShooter.tscn index 8c0b17b..ff1da35 100644 --- a/Scenes/SpaceShooter.tscn +++ b/Scenes/SpaceShooter.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=34 format=3 uid="uid://det8556rpxhbv"] +[gd_scene load_steps=35 format=3 uid="uid://det8556rpxhbv"] [ext_resource type="PackedScene" uid="uid://tlr55u0gn20l" path="res://Packed-Scenes/PlayerShip.tscn" id="1_njb5h"] [ext_resource type="Texture2D" uid="uid://cg6n1hh3lj7rn" path="res://Textures/tile_nebula_green_dff.png" id="2_43vix"] @@ -20,6 +20,7 @@ [ext_resource type="Texture2D" uid="uid://bffseflkbu88e" path="res://Images/generic_arrow_long.png" id="18_b2vca"] [ext_resource type="Texture2D" uid="uid://c4l1soqbo0rud" path="res://Images/keyboard_arrows.png" id="19_dpw4m"] [ext_resource type="Texture2D" uid="uid://bnh0rcsf30nrm" path="res://Images/keyboard_w.png" id="20_3aqu5"] +[ext_resource type="Texture2D" uid="uid://b3ucjch8b7rve" path="res://Images/flair_disabled_cross.png" id="21_7mvgi"] [ext_resource type="Texture2D" uid="uid://cm7ru4t8ka3jn" path="res://Images/keyboard_a.png" id="21_of2rn"] [ext_resource type="Texture2D" uid="uid://c2n36lnm2f5he" path="res://Images/keyboard_s.png" id="22_1rcux"] [ext_resource type="Texture2D" uid="uid://uy20bgblsk4x" path="res://Images/keyboard_d.png" id="23_o81a8"] @@ -31,11 +32,11 @@ [sub_resource type="BoxShape3D" id="BoxShape3D_bw288"] -[sub_resource type="LabelSettings" id="LabelSettings_dqsad"] +[sub_resource type="LabelSettings" id="LabelSettings_vf3s8"] font_size = 50 -font_color = Color(1, 0, 0, 1) +font_color = Color(0.233592, 0.506913, 1, 1) outline_size = 3 -outline_color = Color(1, 0.999986, 0.00293482, 1) +outline_color = Color(0, 1, 0.00392157, 1) shadow_size = 10 shadow_offset = Vector2(5, 5) @@ -46,11 +47,11 @@ keycode = 4194309 [sub_resource type="Shortcut" id="Shortcut_soxs4"] events = [SubResource("InputEventKey_gjrl7")] -[sub_resource type="LabelSettings" id="LabelSettings_vf3s8"] +[sub_resource type="LabelSettings" id="LabelSettings_dqsad"] font_size = 50 -font_color = Color(0.233592, 0.506913, 1, 1) +font_color = Color(1, 0, 0, 1) outline_size = 3 -outline_color = Color(0, 1, 0.00392157, 1) +outline_color = Color(1, 0.999986, 0.00293482, 1) shadow_size = 10 shadow_offset = Vector2(5, 5) @@ -155,19 +156,17 @@ asteroidsContainer = NodePath("../Asteroids") process_mode = 3 script = ExtResource("15_uovst") -[node name="Ui" type="Node2D" parent="." node_paths=PackedStringArray("rtlAsteroids", "rtlLevel", "rtlLifes", "rtlNextLevel", "rtlPoints", "vBoxGameOver", "lblGameOver", "buttonRestart", "lblReachedPoints", "healthBar", "vBoxPause", "buttonResume", "buttonPauseRestart", "vBoxCountdown", "lblCountdown", "textAnyKey", "lblAnyKey")] +[node name="Ui" type="Node2D" parent="." node_paths=PackedStringArray("lblLevel", "lblPoints", "lblNextLevel", "vBoxGameOver", "lblGameOver", "buttonRestart", "lblReachedPoints", "barHealth", "vBoxPause", "buttonResume", "buttonPauseRestart", "vBoxCountdown", "lblCountdown", "textAnyKey", "lblAnyKey", "butExit", "barLevel")] process_mode = 3 script = ExtResource("15_xl7yx") -rtlAsteroids = NodePath("VBoxStats/rtlAsteroids") -rtlLevel = NodePath("VBoxStats/trlLevel") -rtlLifes = NodePath("VBoxStats/rtlLifes") -rtlNextLevel = NodePath("VBoxStats/rtlNextLevel") -rtlPoints = NodePath("VBoxStats/rtlPoints") +lblLevel = NodePath("VBoxStats/lblLevel") +lblPoints = NodePath("VBoxStats/lblPoints") +lblNextLevel = NodePath("VBoxStats/lblNextLevel") vBoxGameOver = NodePath("VBoxGameOver") lblGameOver = NodePath("VBoxGameOver/lblGameOver") -buttonRestart = NodePath("VBoxGameOver/RestartButton") +buttonRestart = NodePath("VBoxGameOver/butRestart") lblReachedPoints = NodePath("VBoxGameOver/lblReachedPoints") -healthBar = NodePath("VBoxHealth/HealthBar") +barHealth = NodePath("HBoxTop/VBoxBars/barHealth") vBoxPause = NodePath("VBoxPause") buttonResume = NodePath("VBoxPause/ButtonResume") buttonPauseRestart = NodePath("VBoxPause/PauseRestartButton") @@ -175,90 +174,69 @@ vBoxCountdown = NodePath("VBoxCountdown") lblCountdown = NodePath("VBoxCountdown/lblCountdown") textAnyKey = NodePath("VBoxCountdown/textPressKey") lblAnyKey = NodePath("VBoxCountdown/lblPressKey") +butExit = NodePath("VBoxGameOver/butExit") +barLevel = NodePath("HBoxTop/VBoxBars/barLevel") -[node name="VBoxStats" type="VBoxContainer" parent="Ui"] -anchors_preset = 2 -anchor_top = 1.0 -anchor_bottom = 1.0 -offset_left = 8.0 -offset_top = 1129.0 -offset_right = 160.0 -offset_bottom = 1269.0 -grow_vertical = 0 +[node name="HBoxTop" type="HBoxContainer" parent="Ui"] +offset_left = 160.0 +offset_top = 25.0 +offset_right = 660.0 +offset_bottom = 25.0 -[node name="rtlAsteroids" type="RichTextLabel" parent="Ui/VBoxStats"] +[node name="VBoxIcons" type="VBoxContainer" parent="Ui/HBoxTop"] +custom_minimum_size = Vector2(100, 50) layout_mode = 2 -size_flags_vertical = 3 -text = "Asteroids: 0" -scroll_active = false -shortcut_keys_enabled = false +tooltip_text = "10 / 10" -[node name="trlLevel" type="RichTextLabel" parent="Ui/VBoxStats"] +[node name="textLife" type="TextureRect" parent="Ui/HBoxTop/VBoxIcons"] layout_mode = 2 -size_flags_vertical = 3 -text = "Level: 1" -scroll_active = false -shortcut_keys_enabled = false -[node name="rtlLifes" type="RichTextLabel" parent="Ui/VBoxStats"] +[node name="textLevel" type="TextureRect" parent="Ui/HBoxTop/VBoxIcons"] layout_mode = 2 -size_flags_vertical = 3 -text = "Lives: 3" -scroll_active = false -shortcut_keys_enabled = false -[node name="rtlNextLevel" type="RichTextLabel" parent="Ui/VBoxStats"] +[node name="VBoxBars" type="VBoxContainer" parent="Ui/HBoxTop"] +custom_minimum_size = Vector2(100, 50) +layout_mode = 2 +tooltip_text = "10 / 10" + +[node name="barHealth" type="ProgressBar" parent="Ui/HBoxTop/VBoxBars"] layout_mode = 2 size_flags_vertical = 3 -text = "Next Level: 10" -scroll_active = false -shortcut_keys_enabled = false +max_value = 10.0 +value = 10.0 +rounded = true +show_percentage = false -[node name="rtlPoints" type="RichTextLabel" parent="Ui/VBoxStats"] +[node name="barLevel" type="ProgressBar" parent="Ui/HBoxTop/VBoxBars"] layout_mode = 2 size_flags_vertical = 3 -text = "Points: 0" -scroll_active = false -shortcut_keys_enabled = false +max_value = 10.0 +value = 10.0 +rounded = true +show_percentage = false -[node name="VBoxGameOver" type="VBoxContainer" parent="Ui"] -process_mode = 3 -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = 201.0 -offset_top = 451.0 -offset_right = 609.0 -offset_bottom = 749.0 -grow_horizontal = 2 -grow_vertical = 2 +[node name="VBoxStats" type="VBoxContainer" parent="Ui"] +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_left = 11.0 +offset_top = 1185.0 +offset_right = 211.0 +offset_bottom = 1265.0 +grow_vertical = 0 -[node name="lblGameOver" type="Label" parent="Ui/VBoxGameOver"] +[node name="lblLevel" type="Label" parent="Ui/VBoxStats"] layout_mode = 2 -text = "Game Over" -label_settings = SubResource("LabelSettings_dqsad") -horizontal_alignment = 1 -vertical_alignment = 1 +text = "Level: 1" -[node name="lblReachedPoints" type="Label" parent="Ui/VBoxGameOver"] -custom_minimum_size = Vector2(0, 100) +[node name="lblPoints" type="Label" parent="Ui/VBoxStats"] layout_mode = 2 -text = "You have reached level 1 and 0 points!" -horizontal_alignment = 1 -vertical_alignment = 1 -autowrap_mode = 3 +text = "Points: 0" -[node name="RestartButton" type="Button" parent="Ui/VBoxGameOver"] -custom_minimum_size = Vector2(200, 0) +[node name="lblNextLevel" type="Label" parent="Ui/VBoxStats"] layout_mode = 2 -size_flags_horizontal = 4 -size_flags_vertical = 6 -button_mask = 5 -shortcut = SubResource("Shortcut_soxs4") -text = "Restart" -icon = ExtResource("17_1t6sc") +text = "Next Level: 10 +" [node name="VBoxPause" type="VBoxContainer" parent="Ui"] anchors_preset = 8 @@ -300,29 +278,106 @@ shortcut = SubResource("Shortcut_soxs4") text = "Restart" icon = ExtResource("17_1t6sc") -[node name="VBoxHealth" type="VBoxContainer" parent="Ui"] +[node name="VBoxCountdown" type="VBoxContainer" parent="Ui"] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 offset_left = 330.0 -offset_top = 14.0 -offset_right = 482.0 -offset_bottom = 18.0 +offset_top = 524.0 +offset_right = 496.0 +offset_bottom = 892.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 +alignment = 1 -[node name="HealthBar" type="ProgressBar" parent="Ui/VBoxHealth"] +[node name="lblCountdown" type="Label" parent="Ui/VBoxCountdown"] layout_mode = 2 -size_flags_vertical = 3 -max_value = 10.0 -value = 7.0 -rounded = true -show_percentage = false +size_flags_horizontal = 4 +text = "3" +label_settings = ExtResource("27_0p8jc") +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="textPressKey" type="TextureRect" parent="Ui/VBoxCountdown"] +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 +texture = ExtResource("28_g1v6s") +stretch_mode = 2 + +[node name="lblPressKey" type="Label" parent="Ui/VBoxCountdown"] +layout_mode = 2 +size_flags_horizontal = 4 +text = "Press any key to start" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="VBoxGameOver" type="VBoxContainer" parent="Ui"] +process_mode = 3 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = 201.0 +offset_top = 451.0 +offset_right = 609.0 +offset_bottom = 749.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="lblGameOver" type="Label" parent="Ui/VBoxGameOver"] +layout_mode = 2 +text = "Game Over" +label_settings = SubResource("LabelSettings_dqsad") +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="lblReachedPoints" type="Label" parent="Ui/VBoxGameOver"] +custom_minimum_size = Vector2(0, 100) +layout_mode = 2 +text = "You have reached level 1 and 0 points!" +horizontal_alignment = 1 +vertical_alignment = 1 +autowrap_mode = 3 + +[node name="butRestart" type="Button" parent="Ui/VBoxGameOver"] +custom_minimum_size = Vector2(200, 0) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 6 +button_mask = 5 +shortcut = SubResource("Shortcut_soxs4") +text = "Restart" +icon = ExtResource("17_1t6sc") + +[node name="butExit" type="Button" parent="Ui/VBoxGameOver"] +process_mode = 3 +custom_minimum_size = Vector2(200, 0) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 6 +button_mask = 5 +shortcut = SubResource("Shortcut_soxs4") +text = "Exit" +icon = ExtResource("21_7mvgi") [node name="BoxHelp" type="BoxContainer" parent="Ui"] -anchors_preset = 1 +anchors_preset = 3 anchor_left = 1.0 +anchor_top = 1.0 anchor_right = 1.0 -offset_left = 635.0 -offset_top = 12.0 -offset_right = 787.0 -offset_bottom = 212.0 +anchor_bottom = 1.0 +offset_left = 633.0 +offset_top = 1064.0 +offset_right = 785.0 +offset_bottom = 1264.0 grow_horizontal = 0 +grow_vertical = 0 [node name="VBoxHelp" type="VBoxContainer" parent="Ui/BoxHelp"] layout_mode = 2 @@ -385,41 +440,3 @@ texture = ExtResource("26_oxfmw") [node name="lblPause" type="Label" parent="Ui/BoxHelp/VBoxHelp/HBoxPause"] layout_mode = 2 text = "Pause" - -[node name="VBoxCountdown" type="VBoxContainer" parent="Ui"] -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = 330.0 -offset_top = 524.0 -offset_right = 496.0 -offset_bottom = 892.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_horizontal = 4 -size_flags_vertical = 4 -alignment = 1 - -[node name="lblCountdown" type="Label" parent="Ui/VBoxCountdown"] -layout_mode = 2 -size_flags_horizontal = 4 -text = "3" -label_settings = ExtResource("27_0p8jc") -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="textPressKey" type="TextureRect" parent="Ui/VBoxCountdown"] -layout_mode = 2 -size_flags_horizontal = 4 -size_flags_vertical = 4 -texture = ExtResource("28_g1v6s") -stretch_mode = 2 - -[node name="lblPressKey" type="Label" parent="Ui/VBoxCountdown"] -layout_mode = 2 -size_flags_horizontal = 4 -text = "Press any key to start" -horizontal_alignment = 1 -vertical_alignment = 1 diff --git a/Scripts/GameManager.cs b/Scripts/GameManager.cs index 26218d6..c342753 100644 --- a/Scripts/GameManager.cs +++ b/Scripts/GameManager.cs @@ -30,7 +30,7 @@ public partial class GameManager : Node { private float spawnRate = 1f; private float spawnTimer; - public event EventHandler OnRefreshUi; + public event EventHandler OnRefreshStats; public event EventHandler OnNewCountdown; public event EventHandler OnGameOver; @@ -38,7 +38,7 @@ public partial class GameManager : Node { get => asteroidNumber; set { asteroidNumber = value; - OnRefreshUi?.Invoke(this, EventArgs.Empty); + OnRefreshStats?.Invoke(this, EventArgs.Empty); } } @@ -47,7 +47,7 @@ public partial class GameManager : Node { set { lives = value; if (lives <= 0) GameOver = true; - OnRefreshUi?.Invoke(this, EventArgs.Empty); + OnRefreshStats?.Invoke(this, EventArgs.Empty); } } @@ -56,7 +56,7 @@ public partial class GameManager : Node { set { points = value; if (points >= nextLevelPoints) NextLevel(); - OnRefreshUi?.Invoke(this, EventArgs.Empty); + OnRefreshStats?.Invoke(this, EventArgs.Empty); } } @@ -64,23 +64,25 @@ public partial class GameManager : Node { get => level; private set { level = value; - OnRefreshUi?.Invoke(this, EventArgs.Empty); + OnRefreshStats?.Invoke(this, EventArgs.Empty); } } + + public int LastLevelPoints { get; private set; } public int NextLevelPoints { get => nextLevelPoints; private set { nextLevelPoints = value; - OnRefreshUi?.Invoke(this, EventArgs.Empty); + OnRefreshStats?.Invoke(this, EventArgs.Empty); } } - public int AsteroidMaxNumber { + private int AsteroidMaxNumber { get => asteroidMaxNumber; - private set { + set { asteroidMaxNumber = value; - OnRefreshUi?.Invoke(this, EventArgs.Empty); + OnRefreshStats?.Invoke(this, EventArgs.Empty); } } @@ -90,11 +92,18 @@ public partial class GameManager : Node { set { gamePaused = value; GetTree().Paused = gamePaused; - OnRefreshUi?.Invoke(this, EventArgs.Empty); + OnRefreshStats?.Invoke(this, EventArgs.Empty); + } + } + + private bool countdown; + public bool Countdown { + get => countdown; + set { + countdown = value; + if (countdown) OnNewCountdown?.Invoke(this, EventArgs.Empty); } } - - public bool Countdown { get; set; } public static GameManager Instance { get; private set; } [Export] public bool Debug { get; private set; } = true; @@ -103,10 +112,8 @@ public partial class GameManager : Node { Instance = this; Lives = MaxLives; spawnTimer = spawnRate; - SoundManager.Instance.Play(SoundManager.Sound.BackgroundMusic); - OnRefreshUi?.Invoke(this, EventArgs.Empty); Countdown = true; - OnNewCountdown?.Invoke(this, EventArgs.Empty); + SoundManager.Instance.Play(SoundManager.Sound.BackgroundMusic); } public override void _Process(double delta) { @@ -131,6 +138,7 @@ public partial class GameManager : Node { private void NextLevel() { Ui.Instance.ShowMessage("Next Level!"); Level++; + LastLevelPoints = NextLevelPoints; NextLevelPoints = Level * 33; AsteroidMaxNumber = 3 + Level; spawnRate = 1f - Level * 0.1f; diff --git a/Scripts/Ui.cs b/Scripts/Ui.cs index ae2be67..0735107 100644 --- a/Scripts/Ui.cs +++ b/Scripts/Ui.cs @@ -6,16 +6,14 @@ using Godot; namespace GodotspaceShooter.Scripts; public partial class Ui : Node2D { - [Export] private RichTextLabel rtlAsteroids; - [Export] private RichTextLabel rtlLevel; - [Export] private RichTextLabel rtlLifes; - [Export] private RichTextLabel rtlNextLevel; - [Export] private RichTextLabel rtlPoints; + [Export] private Label lblLevel; + [Export] private Label lblPoints; + [Export] private Label lblNextLevel; [Export] private VBoxContainer vBoxGameOver; [Export] private Label lblGameOver; [Export] private Button buttonRestart; [Export] private Label lblReachedPoints; - [Export] private ProgressBar healthBar; + [Export] private ProgressBar barHealth; [Export] private VBoxContainer vBoxPause; [Export] private Button buttonResume; [Export] private Button buttonPauseRestart; @@ -23,6 +21,8 @@ public partial class Ui : Node2D [Export] private Label lblCountdown; [Export] private TextureRect textAnyKey; [Export] private Label lblAnyKey; + [Export] private Button butExit; + [Export] private ProgressBar barLevel; private const double countdownMaxTimer = 3; private double countdownTimer = countdownMaxTimer; @@ -35,9 +35,9 @@ public partial class Ui : Node2D if (GameManager.Instance is null) GD.PrintErr("No GameManager found!"); else { - GameManager.Instance.OnRefreshUi += GameManager_OnRefreshUi; - GameManager.Instance.OnNewCountdown += GameManagerOnNewCountdown; - GameManager.Instance.OnGameOver += GameManager_OnGameOver; + GameManager.Instance.OnRefreshStats += GameManager_RefreshStats; + GameManager.Instance.OnNewCountdown += GameManager_NewCountdown; + GameManager.Instance.OnGameOver += GameManager_GameOver; InputManager.Instance.StartCountdown += InputManager_StartCountdown; lblGameOver.Visible = GameManager.Instance.GameOver; buttonRestart.Visible = GameManager.Instance.GameOver; @@ -45,11 +45,14 @@ public partial class Ui : Node2D buttonRestart.Pressed += ButtonRestartOnPressed; buttonResume.Pressed += ButtonResumeOnPressed; buttonPauseRestart.Pressed += ButtonPauseRestartOnPressed; - GameManager_OnRefreshUi(this, EventArgs.Empty); + butExit.Pressed += ButExitOnPressed; + GameManager_RefreshStats(this, EventArgs.Empty); } } - private void GameManager_OnGameOver(object sender, EventArgs e) { + private void ButExitOnPressed() => GetTree().Quit(); + + private void GameManager_GameOver(object sender, EventArgs e) { GD.Print($"Game Over! You have reached level {GameManager.Instance.Level} and {GameManager.Instance.Points} points!"); lblReachedPoints.Text = $"You have reached level {GameManager.Instance.Level} and {GameManager.Instance.Points} points!"; foreach (CanvasItem canvasItem in vBoxGameOver.GetChildren().Cast()) canvasItem.Visible = true; @@ -62,11 +65,10 @@ public partial class Ui : Node2D countdownRunning = true; } - private void GameManagerOnNewCountdown(object sender, EventArgs e) { + private void GameManager_NewCountdown(object sender, EventArgs e) { lblCountdown.Text = countdownTimer.ToString(CultureInfo.InvariantCulture); + foreach (CanvasItem canvasItem in vBoxCountdown.GetChildren().Cast()) canvasItem.Visible = true; vBoxCountdown.Visible = true; - lblAnyKey.Visible = true; - textAnyKey.Visible = true; } public override void _Process(double delta) { @@ -74,6 +76,7 @@ public partial class Ui : Node2D countdownTimer -= delta; lblCountdown.Text = Mathf.RoundToInt(countdownTimer).ToString(); if (countdownTimer <= 0) { + foreach (CanvasItem canvasItem in vBoxCountdown.GetChildren().Cast()) canvasItem.Visible = false; vBoxCountdown.Visible = false; countdownRunning = false; GameManager.Instance.Countdown = false; @@ -81,14 +84,19 @@ public partial class Ui : Node2D } } - private void GameManager_OnRefreshUi(object sender, EventArgs e) { - rtlLifes.Text = $"Lives: {GameManager.Instance.Lives}"; - rtlAsteroids.Text = $"Asteroids: {GameManager.Instance.AsteroidNumber} / {GameManager.Instance.AsteroidMaxNumber}"; - rtlPoints.Text = $"Points: {GameManager.Instance.Points}"; - rtlNextLevel.Text = $"Next Level at: {GameManager.Instance.NextLevelPoints}"; - rtlLevel.Text = $"Actual Level: {GameManager.Instance.Level}"; - healthBar.MaxValue = GameManager.Instance.MaxLives; - healthBar.Value = GameManager.Instance.Lives; + private void GameManager_RefreshStats(object sender, EventArgs e) { + lblLevel.Text = $"Actual Level: {GameManager.Instance.Level}"; + lblPoints.Text = $"Points: {GameManager.Instance.Points}"; + lblNextLevel.Text = $"Next Level at: {GameManager.Instance.NextLevelPoints}"; + + barHealth.MaxValue = GameManager.Instance.MaxLives; + barHealth.Value = GameManager.Instance.Lives; + barHealth.TooltipText = $"{GameManager.Instance.Lives} / {GameManager.Instance.MaxLives}"; + + barLevel.MaxValue = GameManager.Instance.NextLevelPoints; + barLevel.Value = GameManager.Instance.Points - GameManager.Instance.LastLevelPoints; + barLevel.TooltipText = $"{GameManager.Instance.Points} / {GameManager.Instance.NextLevelPoints}"; + vBoxPause.Visible = GameManager.Instance.GamePaused; vBoxGameOver.Visible = GameManager.Instance.GameOver; }