Download

Side Scroller shoot projectile in front of character

How can I spawn a projectile when I press a button so it shoots out of my character and just goes straight?

First make projectile that when spawned moves forward. For this you can use physics or “projectile movement component”.
Then get forward vector of character, make rotator out of it and spawn projectile with that rotation.
Good idea would be adding like 50* forward vector to spawn location so projectile is not spawned inside character “private area”.

If there are gaps in your knowledge, watch some tutorials.

First of all setup a new actor.

Add a collision component to it

Then add either a mesh, flipbook, sprite, ect. Whatever your projectile is going to look like.

Next add a Projectile Movement

Click on your projectile movement and under the details tab set Projectile Gravity Scale to 0, that way it will always go straight.

Should look like this:

4vmrOrL.jpg

Next go into your character BP and set this up: You can skip the DoOnce and the Delay if you want, I just put that there so the player can only shoot once every 1 second, that way they can’t shoot as fast as they click.

If you have anymore questions let me know.

MVaqvji.png

I hooked everything up but it is only shooting to the right no matter where I face. Also what should I have the Offset value set to, and is the ‘Sprite’ the mesh of the character?

Yes sprite is the character, I had the same problem you are having and then I made the BP just like you see above and had no problems since