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:
@@ -4,7 +4,7 @@ using System;
|
||||
public partial class Enemy : StaticBody2D
|
||||
{
|
||||
[Signal]
|
||||
public delegate void TurnDoneEventHandler();
|
||||
public delegate void DeathEventHandler(Enemy THIS);
|
||||
public int _damage = 1, _health = 2;
|
||||
public Vector2 _speed = Vector2.Up, _range = Vector2.Up;
|
||||
public float _movement = 0;
|
||||
@@ -20,24 +20,19 @@ public partial class Enemy : StaticBody2D
|
||||
COMMANDER.TakeDamage(_damage, this);
|
||||
}
|
||||
|
||||
public void PlaceOrMove(GridMarker GRIDMARKER)
|
||||
public void CounterAttack(Commander COMMANDER)
|
||||
{
|
||||
_gridMarker = GRIDMARKER;
|
||||
GlobalPosition = _gridMarker.GlobalPosition;
|
||||
|
||||
}
|
||||
|
||||
public void TakeDamage(int DAMAGE, Commander ATTACKER)
|
||||
{
|
||||
GD.Print(_health, _health - DAMAGE);
|
||||
_health -= DAMAGE;
|
||||
GD.Print($"Taking {DAMAGE}, Health is now {_health}");
|
||||
CounterAttack(ATTACKER);
|
||||
if (_health <= 0)
|
||||
{
|
||||
QueueFree();
|
||||
EmitSignal(SignalName.Death, this);
|
||||
}
|
||||
}
|
||||
|
||||
public void TakeTurn()
|
||||
{
|
||||
// PlaceOrMove(_gridMarker._gridMarkers[(int)(_gridMarker._address.Y + _speed.Y)][(int)(_gridMarker._address.X + _speed.X)]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user