53 lines
1.5 KiB
GDScript
53 lines
1.5 KiB
GDScript
extends Window
|
|
|
|
var elapsed_time = 0.0 # Initialize a variable to keep track of elapsed time
|
|
var time_text=""
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
pass # Replace with function body.
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
elapsed_time += delta # Increment the elapsed time by the frame's delta time
|
|
var hours = int(elapsed_time / 3600)
|
|
var minutes = int(elapsed_time / 60) % 60
|
|
var seconds = int(elapsed_time) % 60
|
|
var time_string = "%02d:%02d:%02d" % [hours, minutes, seconds] # Format time as H:M:S
|
|
var fps = Engine.get_frames_per_second() # Get the current FPS
|
|
time_text = time_string+" "+str(fps) + " fps" # Combine FPS and runtime into one string
|
|
if %Map.controlling and is_instance_valid(%Map.controlling):
|
|
time_text += " [H:"+str(%Map.controlling.health)+"]"
|
|
|
|
func _on_timer_timeout():
|
|
var pl=0
|
|
var po=0
|
|
var rpl=0
|
|
var gpl=0
|
|
var bpl=0
|
|
var rpo=0
|
|
var gpo=0
|
|
var bpo=0
|
|
|
|
for node in %Map.get_children():
|
|
if node is Player:
|
|
pl+=1
|
|
rpl+=node.carrying_r
|
|
gpl+=node.carrying_g
|
|
bpl+=node.carrying_b
|
|
if node is Pool:
|
|
po+=1
|
|
rpo+=node.mana_r
|
|
gpo+=node.mana_g
|
|
bpo+=node.mana_b
|
|
$Label.text=\
|
|
time_text + "\n" +\
|
|
"Players: "+str(pl)+"\n"+ \
|
|
"Pools: "+str(po)+"\n"+ \
|
|
"R: "+str(rpo+rpl)+" ("+str(rpo)+"+"+str(rpl)+")\n"+\
|
|
"G: "+str(gpo+gpl)+" ("+str(gpo)+"+"+str(gpl)+")\n"+\
|
|
"B: "+str(bpo+bpl)+" ("+str(bpo)+"+"+str(bpl)+")\n"
|
|
|
|
func _on_close_requested():
|
|
hide()
|