I think I've figured it out (after some head scratching and debugging)
The reason the lasers are following the ship is because it is a child node of the ship, so ship movement on the horizontal is applied to the lasers. Because they are child nodes, any movement on the parent is added to the bullets.
Thankfully it is a relatively easy fix. The first thing you need to do is change shoot to the following:
`
func shoot():
define laser positions to right and left cannon
var pos_left = $cannons/left.global_position
var pos_right = $cannons/right.global_position
call function for spawning laser with correct positions
create_laser(pos_left)
create_laser(pos_right)
pass
`
The change here is so we pass the global positions of the cannons instead of their local positions. This will allow us to place them in the correct space regardless of which node the lasers are children of.
The second thing we need to change is in create_laser:
`
func create_laser(pos):
create instance
var laser = scn_laser.instance()
set laser position to position from cannons defined in func shoot
laser.global_position = pos
get_parent().add_child(laser)
pass
`
I changed a couple things: The first thing I changed is how we set the laser's position. Instead of setting position, I changed it to global position, which allows us to place the laser at the correct position regardless of which node it is a child of.
The second change is instead of parenting it to the player using add_child, I instead changed it to get_parent().add_child. This will make the laser a child of whatever node is the player's parent, in this case world.
With those changes in place, the lasers should now move independently of the player!
Hopefully this helps, let me know if something does not make sense and I'll do my best to explain.
Also, good night :smile: