diff options
author | IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> | 2022-07-17 13:03:35 +0200 |
---|---|---|
committer | IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> | 2022-07-17 13:03:35 +0200 |
commit | f48908a84490657bc03f4b41d0fc977c1381d0b9 (patch) | |
tree | 77a515649d9428fc0cb3c34dd9918317783f32f4 /godot/scenes/Game.gd | |
parent | 18ab11eeb4464626fe27cbc8296967be0f5de993 (diff) | |
download | 2022-f48908a84490657bc03f4b41d0fc977c1381d0b9.tar.gz 2022-f48908a84490657bc03f4b41d0fc977c1381d0b9.tar.bz2 2022-f48908a84490657bc03f4b41d0fc977c1381d0b9.zip |
player evaluation at the end
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() |