extends Control

var temppos = Vector2.ZERO


func _new_field(new_name,value):
	var field = Label.new()
	field.name = new_name
	field.text = str(new_name)+": "+str(value)
	$VBox.add_child(field)


func update_field(f_name,value):
	if $VBox.has_node(f_name):
		$VBox.get_node(f_name).text = str(f_name)+": "+str(value)
	else:
		_new_field(f_name,value)


func _process(_delta):
	temppos = get_parent().get_parent().get_node("Objects/Player").get_pos()
	update_field("FPS",Engine.get_frames_per_second())
	update_field("Position",Vector2(round(temppos.x),round(temppos.y)))
	update_field("Health",stats.health)
