From 2f5e46e851c1541b623061da3257c7309f341aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Sat, 20 Nov 2021 18:46:23 +0100 Subject: [PATCH] Fix reset logic to use furthest_checkpoint instead of last --- scenes/base_track_level.gd | 6 +++--- scenes/tracks/track.gd | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scenes/base_track_level.gd b/scenes/base_track_level.gd index 6607c5c..932211c 100644 --- a/scenes/base_track_level.gd +++ b/scenes/base_track_level.gd @@ -10,7 +10,7 @@ onready var track = $Track func _ready() -> void: - reset_player_to(track.get_last_checkpoint(), player_node) + reset_player_to(track.get_furthest_checkpoint(), player_node) add_child(player_node) add_child(gui) var player_camera = CAMERA.instance() @@ -38,9 +38,9 @@ func reset_player_to(node_to_reset_to: Node, player_node: BuggedVehicle) -> void func _process(_delta: float) -> void: if Input.is_action_just_released("reset_vehicle"): - reset_player_to(track.get_last_checkpoint(), player_node) + reset_player_to(track.get_furthest_checkpoint(), player_node) func _on_ResetArea_body_entered(body: Node) -> void: if body.get_groups().has("car"): - reset_player_to(track.get_last_checkpoint(), body) + reset_player_to(track.get_furthest_checkpoint(), body) diff --git a/scenes/tracks/track.gd b/scenes/tracks/track.gd index c35a4c0..bd80fc9 100644 --- a/scenes/tracks/track.gd +++ b/scenes/tracks/track.gd @@ -22,8 +22,8 @@ onready var checkpoints = $Checkpoints onready var path: Path = get_node(track_path) -func get_last_checkpoint() -> Node: - return checkpoints.get_child(max(0, last_checkpoint)) +func get_furthest_checkpoint() -> Node: + return checkpoints.get_child(max(0, furthest_checkpoint)) func _ready() -> void: