aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com>2022-07-17 13:03:35 +0200
committerLibravatar IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com>2022-07-17 13:03:35 +0200
commitf48908a84490657bc03f4b41d0fc977c1381d0b9 (patch)
tree77a515649d9428fc0cb3c34dd9918317783f32f4
parent18ab11eeb4464626fe27cbc8296967be0f5de993 (diff)
download2022-f48908a84490657bc03f4b41d0fc977c1381d0b9.tar.gz
2022-f48908a84490657bc03f4b41d0fc977c1381d0b9.tar.bz2
2022-f48908a84490657bc03f4b41d0fc977c1381d0b9.zip
player evaluation at the end
-rw-r--r--godot/scenes/Game.gd29
-rw-r--r--godot/scenes/Game.tscn16
2 files changed, 44 insertions, 1 deletions
diff --git a/godot/scenes/Game.gd b/godot/scenes/Game.gd
index 56456c0..10bfad0 100644
--- a/godot/scenes/Game.gd
+++ b/godot/scenes/Game.gd
@@ -47,7 +47,8 @@ func _on_MainMenuButton_pressed():
func end_level():
- open_scoreboard()
+ open_scoreboard()
+ evaluate_player(current_strokes, PAR[current_level_id])
post_game = true
@@ -89,3 +90,29 @@ func next_level():
levels[current_level_id].show()
close_scoreboard()
+ $Evaluation.hide()
+
+
+func evaluate_player(strokes, par):
+ if strokes <= 1:
+ $Evaluation/EvaluationLabel.text = "HOLE IN ONE"
+ $Evaluation.show()
+ return
+
+ var diff = strokes - par
+ if diff < -2:
+ $Evaluation/EvaluationLabel.text = "%d" % diff
+ elif diff == -2:
+ $Evaluation/EvaluationLabel.text = "EAGLE"
+ elif diff == -1:
+ $Evaluation/EvaluationLabel.text = "BIRDIE"
+ elif diff == 0:
+ $Evaluation/EvaluationLabel.text = "PAR"
+ elif diff == 1:
+ $Evaluation/EvaluationLabel.text = "BOGEY"
+ elif diff == 2:
+ $Evaluation/EvaluationLabel.text = "DOUBLE BOGEY"
+ else:
+ $Evaluation/EvaluationLabel.text = "+%d" % diff
+
+ $Evaluation.show()
diff --git a/godot/scenes/Game.tscn b/godot/scenes/Game.tscn
index 411b825..56f5c55 100644
--- a/godot/scenes/Game.tscn
+++ b/godot/scenes/Game.tscn
@@ -16,6 +16,22 @@ visible = false
margin_right = -0.319946
margin_bottom = 0.47998
+[node name="Evaluation" type="Control" parent="."]
+visible = false
+anchor_right = 1.0
+anchor_bottom = 1.0
+
+[node name="EvaluationLabel" type="Label" parent="Evaluation"]
+anchor_left = 0.3
+anchor_top = 0.4
+anchor_right = 0.7
+anchor_bottom = 0.5
+theme = ExtResource( 3 )
+text = "Finished
+"
+align = 1
+valign = 1
+
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 6 )
autoplay = true