Fix range enemy rotation

This commit is contained in:
2023-09-06 17:59:16 -07:00
parent aac5fbd297
commit f4c0944afa
5 changed files with 175 additions and 165 deletions

View File

@@ -4,7 +4,7 @@ using System.Linq;
public partial class FireAtPlayer : Timer
{
[Export]
private Area3D _enemy;
private StaticBody3D _enemy;
[Export]
private PackedScene _fireProjectile;
@@ -16,7 +16,7 @@ public partial class FireAtPlayer : Timer
var convertedPlayers = players.Select(x => (Node3D)x);
var target = convertedPlayers.OrderBy(x => _enemy.Position.DistanceTo(x.Position)).FirstOrDefault();
var projectile = _fireProjectile.Instantiate<Projectile>() as EnemyBullet;
projectile.Rotation = _enemy.Rotation;
projectile.Rotation = new Vector3(0, _enemy.Rotation.Y, 0);
projectile.Position = _enemy.Position;
GetParent().AddChild(projectile);
}