aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-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