I'm making a local multiplayer top down shooter game as my first ever Godot game.
Player One moves using WASD and shoots using the space bar. You move in degrees of 45, and I've succesfully been able to get the player to move and shoot the laser forward at the correct angle.
However, I don't know how to get the laser to be in the same orientation as the player. I've tried things like creating a global variable for the player node and using that in my laser script to get the rotation of that node, but that didn't work.
I also tried doing something like (sorry if code is wrong I'm just remembering off the top of my head)
set_rotd(get_rotd(get_parent().get_node("player1")))
but because of how the laser is instanced, it's technically a child of the main node, not the player1 node.
I couldn't find anything online specific enough for my case (unless I just didn't look hard enough), so I wanted to get some help here.
If I need to elaborate more, let me know.