mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:35:34 +00:00
Bullet spawners in editor and bullets come out at the spanwer position
This commit is contained in:
parent
e2b9cc8c90
commit
b64e096661
16 changed files with 288 additions and 169 deletions
|
|
@ -188,7 +188,7 @@ public partial class ShootingPattern3D : AttackPattern
|
|||
// Rotate with parent rotation
|
||||
if (pattern.UseParentRotationOffset)
|
||||
{
|
||||
direction = direction.Rotated(-ScriptHost.ParentObject.GlobalRotation.Y + Mathf.DegToRad(90));
|
||||
direction = direction.Rotated(-spawner.GlobalRotation.Y + Mathf.DegToRad(90));
|
||||
}
|
||||
|
||||
// TODO: Fix player aiming for 3D
|
||||
|
|
@ -196,21 +196,21 @@ public partial class ShootingPattern3D : AttackPattern
|
|||
{
|
||||
if (pattern._predictPlayer && GameController.Instance.PlayerVelocity.HasValue)
|
||||
{
|
||||
var predictedDirection = MathFunctions.PredictInterceptPosition(ScriptHost.ParentObject.GlobalPosition.ToVector2(),
|
||||
var predictedDirection = MathFunctions.PredictInterceptPosition(spawner.GlobalPosition.ToVector2(),
|
||||
GameController.Instance.PlayerPosition.Value.ToVector2(), GameController.Instance.PlayerVelocity.Value.ToVector2(),
|
||||
pattern.BulletResource.BulletSpeed);
|
||||
if (predictedDirection.HasValue)
|
||||
{
|
||||
direction = (predictedDirection.Value - ScriptHost.ParentObject.GlobalPosition.ToVector2()).Normalized();
|
||||
direction = (predictedDirection.Value - spawner.GlobalPosition.ToVector2()).Normalized();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
direction = (GameController.Instance.PlayerPosition.Value.ToVector2() - ScriptHost.ParentObject.GlobalPosition.ToVector2()).Normalized();
|
||||
direction = (GameController.Instance.PlayerPosition.Value.ToVector2() - spawner.GlobalPosition.ToVector2()).Normalized();
|
||||
}
|
||||
}
|
||||
|
||||
var spawnPosition = ScriptHost.ParentObject.GlobalPosition + pattern.EmitterOffset;
|
||||
var spawnPosition = spawner.GlobalPosition + pattern.EmitterOffset;
|
||||
|
||||
var bullet = pattern.MakeBullet(spawnPosition.ToVector2(), pattern.bulletCount,
|
||||
pattern.spread, angleOffset);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue