teststrecke-game/scripts/times.gd

29 lines
813 B
GDScript3
Raw Normal View History

2024-11-09 10:52:05 +00:00
extends HFlowContainer
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
2025-01-14 19:27:38 +00:00
func addFinishedPlayer(playerid,finalTime,playercount):
2024-11-09 10:52:05 +00:00
print("Finished "+str(playerid)+" final time="+str(finalTime))
var place=get_child_count()+1
2025-01-14 19:27:38 +00:00
2024-11-09 10:52:05 +00:00
var newlabel= Label.new()
add_child(newlabel)
2025-01-14 17:13:13 +00:00
#newlabel.set("theme_override_font_sizes/font_size",40)
2025-01-14 19:27:38 +00:00
newlabel.text=""
if playercount>1: #singleplayer
newlabel.text+=str(place)+": "
newlabel.text+=str(round(finalTime*1000)/1000.0)+"s"
2024-11-09 10:52:05 +00:00
newlabel.set("theme_override_colors/font_color",Gamestate.getPlayers()[playerid].color)
func getPlayersFinished():
return get_child_count()