2024-11-03 18:16:30 +00:00
|
|
|
extends Node2D
|
|
|
|
|
|
|
|
|
|
|
|
# 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 updateCountdown(t):
|
|
|
|
if (t<0):
|
|
|
|
$countdown.visible=false
|
|
|
|
else:
|
|
|
|
$countdown.visible=true
|
|
|
|
$countdown.text=str(t)
|
|
|
|
|
|
|
|
|
2024-12-22 13:27:13 +00:00
|
|
|
func update_playerlist(players:Array[Gamestate.Player],flashplayer_keycode=-1):
|
2024-11-03 18:16:30 +00:00
|
|
|
var Playerlabels=$MarginContainer/VBoxContainer_Playerlist.get_children()
|
|
|
|
var i=0
|
|
|
|
for label in Playerlabels:
|
|
|
|
#print(type_string(typeof(label)))
|
|
|
|
if i<len(players):
|
|
|
|
var p=players[i]
|
|
|
|
label.text=str(OS.get_keycode_string(p.inputkey))
|
2024-12-22 13:27:13 +00:00
|
|
|
if (p.inputkey==flashplayer_keycode): #this player pressed their key again
|
|
|
|
|
|
|
|
var outlinesize=min(max(0,label.get_theme_constant("outline_size")+30),60)
|
|
|
|
label.add_theme_constant_override("outline_size",outlinesize)
|
2024-11-03 18:16:30 +00:00
|
|
|
label.set("theme_override_colors/font_color",p.color)
|
|
|
|
else:
|
|
|
|
label.text=""
|
|
|
|
i+=1
|
2024-12-22 13:27:13 +00:00
|
|
|
|
|
|
|
func _process(delta: float) -> void:
|
|
|
|
var Playerlabels=$MarginContainer/VBoxContainer_Playerlist.get_children()
|
|
|
|
for label in Playerlabels:
|
|
|
|
var outlinesize=max(0,label.get_theme_constant("outline_size")-2*delta)
|
|
|
|
label.add_theme_constant_override("outline_size",outlinesize)
|
|
|
|
|