teststrecke-game/scripts/times.gd

26 lines
803 B
GDScript

extends HFlowContainer
const fontSize_mini=40
# 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
func addFinishedPlayer(playerid,finalTime):
print("Finished "+str(playerid)+" final time="+str(finalTime))
var place=get_child_count()+1
#print("New Label. Place "+str(place))
var newlabel= Label.new()
add_child(newlabel)
newlabel.set("theme_override_font_sizes/font_size",fontSize_mini)
newlabel.text=str(place)+": "+str(round(finalTime*1000)/1000.0)+"s"
newlabel.set("theme_override_colors/font_color",Gamestate.getPlayers()[playerid].color)
func getPlayersFinished():
return get_child_count()