Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Suleymanov |
I have “Track Record”, “Current Lap”, “Last Lap” and “Best Lap” labels. I got the Current Lap and Last Lap working correctly. But Last Lap (and Best Lap for that matter) gets back to zero once the level (or game) restarted. I need the Last Lap and Best Lap permanently stay there even after the game restarted. I would appreciate any solution you may suggest.
In case you need the script I have:
extends VBoxContainer
var CurrentLap = “Current Lap: "
var LastLap = “Last Lap: "
var BestLap = “Best Lap: "
var ms = 0
var s = 0
var m = 0
func _process(delta):
if ms > 9:
s += 1
ms = 0
if s > 59:
m += 1
s = 0
$CurrentLap.set_text(str(CurrentLap) +str(m)+”:” +str(s)+”:" +str(ms))
func _on_Timer_timeout():
ms += 1
func _on_finishline_area_entered(area):
$LastLap.set_text(str(LastLap) +str(m)+“:” +str(s)+“:” +str(ms))
m = 0
s = 0
ms = 0