forked from Puppet/berry-dash-godot-remake
Added a score system
This commit is contained in:
1 parent
bee846c3ba
commit
87bbaafb75
5 files changed
+70
-1
No files matched your search
@@ -3,6 +3,11 @@ using System;
|
||||
|
||||
public partial class BerryLogic : Node2D {
|
||||
private void _on_hitbox_area_entered(Area2D area) {
|
||||
Globals.Score += 1;
|
||||
if (Globals.Score > Globals.HighScore) {
|
||||
Globals.HighScore += 1;
|
||||
}
|
||||
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
@@ -5,4 +5,7 @@ public partial class Globals : Node {
|
||||
public static string LatestVersion = "";
|
||||
public static string AccessLevel = "";
|
||||
public static bool VersionChecked = false;
|
||||
|
||||
public static int Score = 0;
|
||||
public static int HighScore = 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class ScoreText : Control {
|
||||
public override void _Process(double delta) {
|
||||
Label ScoreText = GetNode<Label>("ScoreLabel");
|
||||
Label HighScoreText = GetNode<Label>("HighScoreLabel");
|
||||
|
||||
ScoreText.Text = "Score: " + Globals.Score;
|
||||
HighScoreText.Text = "High Score: " + Globals.HighScore;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://drbmu7lilwrec
|
||||
Reference in new issue
Block a user