Files
kicking-high/proto3/godot/ui/bars.gd
2020-04-13 12:45:25 +03:00

23 lines
545 B
GDScript3

extends VBoxContainer
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _process(_delta):
if !global.player:
return
var h = global.player.get_meta("health")
var maxh = global.player.get_meta("max_health")
var s = global.player.get_meta("stamina")
var maxs = global.player.get_meta("max_stamina")
$health.value = 100.0 * (1 + h) / (1 + maxh)
$stamina.value = 100.0 * (1 + s) / (1 + maxs)