Boss healthbar
This commit is contained in:
28
Scripts/HealthPoints.cs
Normal file
28
Scripts/HealthPoints.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Godot;
|
||||
|
||||
public partial class HealthPoints : Node
|
||||
{
|
||||
[Export]
|
||||
public long MaximumHP { get; protected set; }
|
||||
|
||||
public long CurrentHP { get; protected set; }
|
||||
|
||||
[Export]
|
||||
private TextureProgressBar _healthBar;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
CurrentHP = MaximumHP;
|
||||
}
|
||||
|
||||
public void TakeDamage(long damage)
|
||||
{
|
||||
CurrentHP -= damage;
|
||||
GD.Print(CurrentHP);
|
||||
}
|
||||
|
||||
public void UpdateHealthbar()
|
||||
{
|
||||
_healthBar.Value = CurrentHP;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user