We will use the look_at() function to aim the turrets
The turrets need to know where the enemy is on the path
In the TurretManager script
send this variable to the
turret when it is created
In the Turret script add a variable
to receive the Path3D from the
Create a variable to represent the enemy
get_children() returns a list of all the enemies
and back selectes the last one in the list.
We will update this later.
Set the turret to look at the global position of the enemy in the up direction Treating the Z axis as forward
Shoot at the enemies by setting the shot direction to the global Z direction
Test this now by running the game and placing turrets. They should rotate to track enemies and fire at them.