added some more signals for attack hit, enemy and player controllers turn done, commander enemy death, better enemy movement and turn changing, implemented an rng, added functions to grid and gridmarkers to allow for easier searching of markers, more logic for if a tower commander has actions

This commit is contained in:
2026-06-01 02:28:45 -04:00
parent facb2e227e
commit dd14a8da40
13 changed files with 138 additions and 60 deletions
+8 -12
View File
@@ -4,10 +4,13 @@ using System;
public partial class Commander : Sprite2D
{
[Signal]
public delegate void TurnDoneEventHandler();
public int _health = 10;
public delegate void DeathEventHandler(Commander THIS);
[Signal]
public delegate void ActionsUpEventHandler();
public int _health = 10, _actionsMax = 1, _actions;
public PackedScene _attackScene = GD.Load<PackedScene>("res://Attack.tscn");
public Attack _attack;
public PlayerController _playerController;
public override void _Process(double delta)
{
@@ -18,21 +21,15 @@ public partial class Commander : Sprite2D
{
_attack.QueueFree();
_attack = null;
EmitSignal(SignalName.ActionsUp);
}
}
}
public void StartTurn()
{
}
public void LoadAttack()
{
if (_attack == null)
{
GD.Print("Loading attack");
_attack = _attackScene.Instantiate<Attack>();
_attack._commanderOwner = this;
_attack.GravityScale = 0;
@@ -45,15 +42,14 @@ public partial class Commander : Sprite2D
_health -= DAMAGE;
if (_health <= 0)
{
GD.Print("GAME OVER");
GetTree().Quit();
EmitSignal(SignalName.Death, this);
}
}
public void ShootCurrentAttack(Vector2 FORCE){
GD.Print("Shooting attack");
_attack.Shoot(FORCE);
_actions--;
}
public void UnloadAttack()