better healthbars and one for the player as well
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 42s
Create tag and build when new code gets to main / Test (push) Successful in 6m13s
Create tag and build when new code gets to main / Export (push) Successful in 7m5s

This commit is contained in:
2026-01-26 18:09:29 +01:00
parent 2fdc9c7ca8
commit ddf1bd019b
12 changed files with 190 additions and 49 deletions

View File

@@ -57,7 +57,7 @@ public partial class Enemy : CharacterBody3D,
// Private stuff
private Area3D _damageBox;
private Node3D _target;
private CHealthbar _healthbar;
private Healthbar _healthbar;
public override void _Ready()
{
@@ -79,7 +79,7 @@ public partial class Enemy : CharacterBody3D,
if (CHealth is null) GD.PrintErr("This node needs a 'CHealth' child of type IHealthable!");
if (CKnockback is null) GD.PrintErr("This node needs a 'CKnockback' child of type IKnockbackable!");
_healthbar = GetNode<CHealthbar>("CHealthBar");
_healthbar = GetNode<CHealthbar>("CHealthBar").Healthbar;
if (RMovement != null) CMovement!.RMovement = RMovement;
if (RHealth != null)
@@ -88,6 +88,7 @@ public partial class Enemy : CharacterBody3D,
CHealth.CurrentHealth = RHealth.StartingHealth;
}
if (RKnockback != null) CKnockback!.RKnockback = RKnockback;
_healthbar.Initialize(CHealth!.CurrentHealth);
}
public void SetupSignals()
@@ -96,7 +97,7 @@ public partial class Enemy : CharacterBody3D,
CDamageable.DamageTaken += (source, record) => ReduceHealth(source, record);
CDamageable.DamageTaken += (source, record) => RegisterKnockback(new KnockbackRecord(record));
CHealth.HealthDepleted += Kill;
HealthChanged += (source, record) => _healthbar.OnHealthChanged(record);
HealthChanged += (source, record) => _healthbar.SetHealth(record.CurrentHealth);
}
public override void _PhysicsProcess(double delta)