diff options
Diffstat (limited to '')
-rw-r--r-- | godot/scenes/Game.gd | 29 |
1 files changed, 28 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() |