trying out enemy animation again
This commit is contained in:
@@ -14,7 +14,7 @@ public partial class Enemy : StaticBody2D
|
||||
public bool _hovered = false, _track = false, _warp = false;
|
||||
public int _damage = 1, _health = 2, _stamina, _staminaRemaining, _visibilityRange = 4, _hitRange, _priority = 1;
|
||||
public Vector2I _address = -Vector2I.One, _range = Vector2I.Up;
|
||||
public List<Vector2I> _path = new();
|
||||
public List<Vector2I> _path = new(), _pathStored = new();
|
||||
public float _movement = 0;
|
||||
public EnemyController _enemyController;
|
||||
|
||||
@@ -42,6 +42,22 @@ public partial class Enemy : StaticBody2D
|
||||
{
|
||||
base._PhysicsProcess(delta);
|
||||
}
|
||||
|
||||
public void AnimateMovement(EnemyController CONTROLLER)
|
||||
{
|
||||
for (int i = 0; i < _path.Count; i++)
|
||||
{
|
||||
Tween subtween = CreateTween();
|
||||
subtween.TweenProperty(this, "global_position", CONTROLLER._playArea._map.GetCellPositionFromAddress(_path[i]), 0.25f);
|
||||
float key = _priority + i/1000;
|
||||
if (!CONTROLLER._tweenStages.ContainsKey(key))
|
||||
{
|
||||
CONTROLLER._tweenStages[key] = new();
|
||||
}
|
||||
CONTROLLER._tweenStages[key].Add(subtween);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Attack(PlayerController PLAYER)
|
||||
{
|
||||
@@ -77,21 +93,9 @@ public partial class Enemy : StaticBody2D
|
||||
return bestPath;
|
||||
}
|
||||
|
||||
public void GetRemainingStamina(Map MAP)
|
||||
public void GetRemainingStamina(EnemyController CONTROLLER)
|
||||
{
|
||||
_staminaRemaining = _address.Y <= MAP.GetFirstOpenRow() ? 0 : _stamina;
|
||||
}
|
||||
|
||||
public void RemainInPlace()
|
||||
{
|
||||
if (_path.Count <= 0)
|
||||
{
|
||||
_path.Add(_address);
|
||||
}
|
||||
else
|
||||
{
|
||||
_path.Add(_path.LastOrDefault());
|
||||
}
|
||||
_staminaRemaining = _address.Y <= CONTROLLER._playArea._map.GetFirstOpenRow() ? 0 : _staminaRemaining;
|
||||
}
|
||||
|
||||
public void TakeDamage(int DAMAGE, Commander ATTACKER)
|
||||
|
||||
Reference in New Issue
Block a user