• 2D
  • (Solved) get simple 2d side scroller projectile to face player

I'm making a simple 2d platformer game and I wanted to give my player a projectile. The problem is that my projectile gets instanced into the game scene and I don't know how to get the direction it fires at to be the same direction my player is facing. I can't connect a signal with the motion vector to the bullet, as it hasn't been instanced yet. What is the method I'm supposed to use? It seems like there is a simple solution that I haven't considered.

Thanks in advance!

the code: https://pastebin.com/XzEaKZMm

you want the bullet.rotation_degrees = player.rotation_degrees. That would work in 3D, not certain of the keywords for 2D. Might be the same.

I actually came up with the solution of using a variable that changes depending on the key the player holds down, Then when I make the bullet I assign that value to an empty variable in it. thanks for the help regardless though!

Sounds awful lot like a little state machine to me. ;) That is certainly one way to do it.

I guess it is one huh? It's Interesting how many different ways people can approach and solve the basic mechanics in their games!