This commit is contained in:
Marco 2025-02-14 10:59:32 +01:00
commit ba2f6a97fc
9 changed files with 254 additions and 26 deletions

View file

@ -18,7 +18,7 @@ public partial class Bullet : Area2D
public DamageType DamageType => _bulletInfo?.DamageType ?? DamageType.Neutral;
private Vector2 _direction = Vector2.Right;
protected Vector2 _direction = Vector2.Right;
private double _elapsedTime = 0f;
private BulletInfo _bulletInfo;
@ -75,7 +75,7 @@ public partial class Bullet : Area2D
}
}
private void RotateBullet(float degrees)
protected virtual void RotateBullet(float degrees)
{
float radians = Mathf.DegToRad(degrees);
_direction = _direction.Rotated(radians).Normalized(); // Rotate direction
@ -88,6 +88,7 @@ public partial class Bullet : Area2D
if (_gameManager.Player != null)
{
_direction = (_gameManager.Player.GlobalPosition - this.GlobalPosition).Normalized();
RotateBullet(0); // quick hack to rotate lasers
//LookAt(player.GlobalPosition);
}
}