aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts/scene_control.gd
diff options
context:
space:
mode:
authorLibravatar perivesta <>2023-07-09 16:27:35 +0200
committerLibravatar perivesta <>2023-07-09 16:27:35 +0200
commit198b60c7830dc79a60a48863877405690c4b038e (patch)
tree4dc79c68961aeb0f434abb7db2d6d82ae70c5285 /Scripts/scene_control.gd
parentc19f69112409eca00029159f31797e13bbab61cf (diff)
parente7845dfe77cafebd30efb660ef56006d5388efb1 (diff)
download2023-198b60c7830dc79a60a48863877405690c4b038e.tar.gz
2023-198b60c7830dc79a60a48863877405690c4b038e.tar.bz2
2023-198b60c7830dc79a60a48863877405690c4b038e.zip
Merge branch 'master' of bunny.garden:jam/gmtk/2023
Diffstat (limited to 'Scripts/scene_control.gd')
-rw-r--r--Scripts/scene_control.gd17
1 files changed, 15 insertions, 2 deletions
diff --git a/Scripts/scene_control.gd b/Scripts/scene_control.gd
index 73d9273..c4d42ec 100644
--- a/Scripts/scene_control.gd
+++ b/Scripts/scene_control.gd
@@ -2,6 +2,10 @@ extends Node
class_name SceneControl
+@export var gold_medal_time = 5.0
+@export var silver_medal_time = 7.0
+@export var bronze_medal_time = 10
+
@onready var path: Path2D = $DrawNode/TrackPath
@onready var path_follow: PathFollow2D = $DrawNode/TrackPath/TrackFollower
@onready var car = $Car
@@ -24,7 +28,7 @@ func _ready():
$UI/Control/PostGameUI/NextLevelButton.pressed.connect(next_level)
var start_button = $Start/Start as TextureButton
- start_button.pressed.connect(start_drawing)
+ start_button.button_down.connect(start_drawing)
reset_level()
@@ -75,10 +79,19 @@ func evaluate_driving():
return false
return true
+func evaluate_time():
+ if current_time < gold_medal_time:
+ return 0
+ if current_time < silver_medal_time:
+ return 1
+ if current_time < bronze_medal_time:
+ return 2
+ return 3
+
func _on_finish_line_body_entered(node: Node2D):
if evaluate_driving():
- ui.switch_to_post_game_UI()
+ ui.switch_to_post_game_UI(evaluate_time())
set_driving(false)
return