Skip to content

Commit e172ffb

Browse files
committed
Mob health decays faster as age increases
1 parent 9e37482 commit e172ffb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Entity/PredatorPreyEntity.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public partial class PredatorPreyEntity<TEntity> : CharacterBody2D, IPredatorPre
1616
{
1717
private const int HealthDecayTimerMin = 10;
1818
private const int HealthDecayTimerMax = 50;
19+
private int _age;
20+
[DebugInfo("AgeDecay")] public int _ageDecayMultiplier = 1;
1921

2022
private AnimatedSprite2D _animatedSprite2D;
2123
private Label _debugLabel;
@@ -175,9 +177,13 @@ private void UpdateHealth()
175177
{
176178
if (_healthDecayTimer.Done())
177179
{
178-
CurrentHealth--;
180+
CurrentHealth -= _ageDecayMultiplier;
179181
if (CurrentHealth <= 0)
180182
Die();
183+
184+
_age++;
185+
if (_age % BaseHealth == 0)
186+
_ageDecayMultiplier++;
181187
}
182188
}
183189

0 commit comments

Comments
 (0)