starting to work on enemy attacks and player health

This commit is contained in:
2026-06-12 02:03:17 -04:00
parent 9f75ec525c
commit 1903e1a1aa
5 changed files with 37 additions and 24 deletions
+15
View File
@@ -5,15 +5,30 @@ using System.Linq;
public partial class PlayerController : TurnController
{
[Signal]
public delegate void DeathEventHandler(PlayerController THIS);
public int _health, _healthMax = 100;
public EnemyController _enemyController;
public PackedScene _commanderScene = GD.Load<PackedScene>("res://Commander.tscn");
public List<Tower> _towers = new();
public override void _Ready()
{
_health = _healthMax;
base._Ready();
}
public void ChangeHealth(int DAMAGE, Node IMPETUS = null)
{
_health += DAMAGE;
_health = Math.Clamp(_health, 0, _healthMax);
GD.Print(_health);
if (_health == 0)
{
EmitSignal(SignalName.Death, this);
}
}
public void CheckForTurnEnd()
{
if (_towers.Where(t => t._commander != null).ToList().All(t=>t._commander._actions == 0))