Fix reset logic to use furthest_checkpoint instead of last

soundtrack
Ensar Sarajčić 2021-11-20 18:46:23 +01:00
parent 54d9ff1cdd
commit 2f5e46e851
2 changed files with 5 additions and 5 deletions

View File

@ -10,7 +10,7 @@ onready var track = $Track
func _ready() -> void: 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(player_node)
add_child(gui) add_child(gui)
var player_camera = CAMERA.instance() 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: func _process(_delta: float) -> void:
if Input.is_action_just_released("reset_vehicle"): 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: func _on_ResetArea_body_entered(body: Node) -> void:
if body.get_groups().has("car"): if body.get_groups().has("car"):
reset_player_to(track.get_last_checkpoint(), body) reset_player_to(track.get_furthest_checkpoint(), body)

View File

@ -22,8 +22,8 @@ onready var checkpoints = $Checkpoints
onready var path: Path = get_node(track_path) onready var path: Path = get_node(track_path)
func get_last_checkpoint() -> Node: func get_furthest_checkpoint() -> Node:
return checkpoints.get_child(max(0, last_checkpoint)) return checkpoints.get_child(max(0, furthest_checkpoint))
func _ready() -> void: func _ready() -> void: