Finishing up basic pathfinding? later down the line will want to implement warping

This commit is contained in:
2026-06-23 03:14:49 -04:00
parent 1903e1a1aa
commit 2cf3428b8c
6 changed files with 142 additions and 129 deletions
+6 -3
View File
@@ -2,11 +2,13 @@ using Godot;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
public partial class PlayerController : TurnController
{
[Signal]
public delegate void DeathEventHandler(PlayerController THIS);
public bool _dead = false;
public int _health, _healthMax = 100;
public EnemyController _enemyController;
public PackedScene _commanderScene = GD.Load<PackedScene>("res://Commander.tscn");
@@ -22,9 +24,10 @@ public partial class PlayerController : TurnController
{
_health += DAMAGE;
_health = Math.Clamp(_health, 0, _healthMax);
GD.Print(_health);
if (_health == 0)
if (_health == 0 && !_dead)
{
_dead = !_dead;
GD.Print("YOU DIED");
EmitSignal(SignalName.Death, this);
}
}
@@ -60,7 +63,7 @@ public partial class PlayerController : TurnController
_towers[3].AddChild(newCommander);
}
public override void StartTurn()
public override async Task StartTurn()
{
_towers.ForEach(t => t.StartTurn());
}