This repository has been archived on 2023-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
dungeon-crawler-demo/scripts/PlayerGui.cs
2020-10-26 00:50:16 -04:00

25 lines
467 B
C#

using Godot;
using System;
public class PlayerGui : CanvasLayer
{
ProgressBar healtbar;
public override void _Ready()
{
healtbar = GetNode<ProgressBar>("Control/HealthBar");
}
public void OnUpdatePlayerGui(Player player)
{
// Update healthbar
if(healtbar != null)
{
healtbar.MaxValue = player.health.max;
healtbar.MinValue = player.health.min;
healtbar.Value = player.health.value;
} else { GD.Print("WARNING: Healtbar not set!"); }
}
}