Skip to content

Commit

Permalink
fixed highscore
Browse files Browse the repository at this point in the history
  • Loading branch information
Joachim-barre committed Jun 2, 2024
1 parent ae67975 commit 4982885
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scenes/hud.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ text = "score:
horizontal_alignment = 1
vertical_alignment = 1

[node name="HiscoreLabel" type="Label" parent="CanvasLayer"]
[node name="HighscoreLabel" type="Label" parent="CanvasLayer"]
offset_left = 130.0
offset_top = 160.0
offset_right = 250.0
Expand Down
2 changes: 1 addition & 1 deletion scripts/hud.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public partial class hud : Control
public void UpdateScore(int Score, int HighScore)
{
GetNode<Label>("CanvasLayer/ScoreLabel").Text = $"score:\n{Score}";
GetNode<Label>("CanvasLayer/ScoreLabel").Text = $"highscore:\n{HighScore}";
GetNode<Label>("CanvasLayer/HighscoreLabel").Text = $"highscore:\n{HighScore}";
}

public void Update(bool _game_over = false)
Expand Down
2 changes: 2 additions & 0 deletions scripts/main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ private void Save(){
try {
Log.dbg("saving game state");
var Save = new SaveData();
Save.HighScore = HighScore;
Save.Score = Score;
Save.LoadVals(GetValues());
ResourceSaver.Save(Save, SavePath);
Expand All @@ -100,6 +101,7 @@ private bool Load(){
try {
Log.dbg("Loading game state");
var Save = ResourceLoader.Load<SaveData>(SavePath);
HighScore = Save.HighScore;
PreScore = Save.Score;
pre_value = Save.GetVals();
OnUndo();
Expand Down

0 comments on commit 4982885

Please sign in to comment.