mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 01:45:54 +00:00
Player can die now
This commit is contained in:
parent
6ff1ab76ed
commit
360b4dfe6a
6 changed files with 87 additions and 24 deletions
|
|
@ -15,6 +15,8 @@ public partial class Enemy : Area2D, IDestructible
|
|||
|
||||
[Export] public double RateOfFire = 0.4f;
|
||||
|
||||
[Export] public float BulletSpeed = 100f;
|
||||
|
||||
private float _currentHealth = 0f;
|
||||
|
||||
private bool _isDestroyed = false;
|
||||
|
|
@ -71,6 +73,7 @@ public partial class Enemy : Area2D, IDestructible
|
|||
// bullet.Transform = this.GlobalTransform;
|
||||
// bullet.Position = this.Position;
|
||||
bullet.SetDirection((_cachedPlayer.GlobalPosition - this.GlobalPosition).Normalized());
|
||||
bullet.Speed = BulletSpeed;
|
||||
_cooldownTimer.Start(RateOfFire);
|
||||
}
|
||||
}
|
||||
|
|
@ -117,6 +120,14 @@ public partial class Enemy : Area2D, IDestructible
|
|||
|
||||
}
|
||||
|
||||
private void Explode()
|
||||
{
|
||||
Debug.WriteLine("Ded");
|
||||
//CreateParticles();
|
||||
//CreateDebris();
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
public void Hit(float damage)
|
||||
{
|
||||
if (_isDestroyed) return;
|
||||
|
|
@ -127,14 +138,6 @@ public partial class Enemy : Area2D, IDestructible
|
|||
Explode();
|
||||
}
|
||||
|
||||
private void Explode()
|
||||
{
|
||||
Debug.WriteLine("Ded");
|
||||
//CreateParticles();
|
||||
//CreateDebris();
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
public bool IsDestroyed()
|
||||
{
|
||||
return _isDestroyed;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue