mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:35:34 +00:00
Selective bullet rotation
This commit is contained in:
parent
538f4f215f
commit
5624d0178c
8 changed files with 52 additions and 10 deletions
|
|
@ -117,16 +117,19 @@ public partial class Bullet : Area2D
|
|||
//SetRotationDegrees(RotationDegrees + degrees);
|
||||
float radians = Mathf.DegToRad(degrees);
|
||||
_direction = _direction.Rotated(radians).Normalized(); // Rotate direction
|
||||
if (!BulletInfo.RotateSprite) return;
|
||||
SetRotation(Rotation + radians);
|
||||
}
|
||||
|
||||
public virtual void RotateSpriteDegrees(float degrees)
|
||||
{
|
||||
if (!BulletInfo.RotateSprite) return;
|
||||
SetRotationDegrees(RotationDegrees + degrees);
|
||||
}
|
||||
|
||||
public virtual void RotateSprite(float radians)
|
||||
{
|
||||
if (!BulletInfo.RotateSprite) return;
|
||||
SetRotation(Rotation + radians);
|
||||
}
|
||||
|
||||
|
|
@ -156,6 +159,7 @@ public partial class Bullet : Area2D
|
|||
|
||||
_direction = normalized;
|
||||
|
||||
if (!BulletInfo.RotateSprite) return;
|
||||
SetRotation(Mathf.Atan2(normalized.Y, normalized.X) + Mathf.Pi / 2);
|
||||
|
||||
//Debug.WriteLine($"Bullet Shot at direction {direction.X} {direction.Y}");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue