mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:35:34 +00:00
Lasers
This commit is contained in:
parent
95979bd3b8
commit
ba2f6a97fc
9 changed files with 254 additions and 26 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue