How can shoot my projectile in the opposite direction in a 2d game?

I have a projectile firing to the right but if I am looking to the left it still shoots to the right. The spawn location of the projectile is done by getting the actor’s transform. Any ideas?

What vektor do you use for calculating the direction of the projectile?
You would need to turn your Projectile to the specific direction at spawn.

I figure this out but I am not sure if it was the right way. I had it change the velocity of the projectile into the negatives. It works but I am not sure if that was the right way

In a small 2D attempt of mine I rotated my character and spawned the bullets in with a normal positive velocity while setting their transform equal to the player transform.

That way it would always be rotated the way my player is rotated.

The thing is: I don’t know what your 2D Game is. Are you just firing straight to the left and right or can your player aim with the mouse? Or does he aim with the arrow keys in 8 different directions?

To give you the answer to your question, i would need to know this.

I will just answer as if you would only shoot lift and right.

Let’s say your Character moves along the X-Axis.
You left is negativ X and right is positiv X.
Now you would check if the forward vektor of your character is positiv or negativ. But only the X of that vector. If it’s positiv, you would shoot in (1, 0, 0).
Is it negativ you shoot in (-1, 0, 0). (X, Y, Z) seen as a direction vektor.

Is this what you have done or at least similar? Than it’s ok i guess.
I always say: If it works, why not using it? (:

This is also ok. Till now we don’t know how his game works.

I can only shoot left and right. I have done it with a switch that turns on when i face left. I set the velocity to the negative. And reset it when I turn right. Seems like a couple different ways to do it.

Hi…

here is your answer on how to get the pawn shooting in both directions.

Thank you!