Spawning an 2d (flipbook) projectile

Hi there,

I’m in need of some help with spawning a 2d projectile.
I’m having difficulty with my 2d character spawning a 2d projectile when the left mouse button is pressed and the fire animation starts playing. When the left mouse button is pressed a flipbook animation starts to play in which he ready’s his gun.

I want my projectile, which is a 2d flipbook animation, to fire in either way he is facing (left or right). How do i approach this? I hope someone can point me in the right dirrection?

Regards

HI…

First you need to create your 2d flipbook of your projectile, then create a blueprint component based on actor class.
Where you add your 2d flipbook, a collision trigger and projectile movement

Then once completed, You are ready to start adding the shooting from your character
I have attached some screenshot, let me know if it helps and i can explain more if needed.

569873915159cd6642b4fa1d2e519560cb1f96d9.jpeg
367dc6332f943ebffe2f29ceeaa9b8343052ea60.jpeg
c6b9b375226783b5c505b54af12965fa3a93416d.jpeg

Thank you for your response. I will try it out tonight, hope it works out! :slight_smile:

Quick question though, do i need to a an value to the variable ‘Power’ and ‘Stick offset’?

Edit: NVM

[=;133804]
HI…

First you need to create your 2d flipbook of your projectile, then create a blueprint component based on actor class.
Where you add your 2d flipbook, a collision trigger and projectile movement

Then once completed, You are ready to start adding the shooting from your character
I have attached some screenshot, let me know if it helps and i can explain more if needed.

[/]

Yes!! Thank you very much brother it works!! :smiley:
I have a few questions though, firing the projectile works, but only in one direction too the right. When i turn left it still fires right?

Also it only fires once when mouse is pressed. I want it to spray bullets as long as the mouse is pressed and stop when released.

And last would it be possible to add and play flipbook animation of muzzle fire, together with firing the projectile?

Thanks in advance!

I have a few questions though, firing the projectile works, but only in one direction too the right. When i turn left it still fires right?
(Oh… In my game i only needed it to the right. So i hadn’t realized it didn’t go the other way… I will figure it out and let you know)

Also it only fires once when mousOhe is pressed. I want it to spray bullets as long as the mouse is pressed and stop when released.
Screenshot Below
676ec866a1bb941c350cc8ece2855ed2b0f11918.jpeg

And last would it be possible to add and play flipbook animation of muzzle fire, together with firing the projectile?
(Im in the process of doing this right now, once completed. I will let you know)

Hi ,

You should be able to use the transform you have to get the players rotation, which will apply to your spawned projectile.

[=;137718]
I have a few questions though, firing the projectile works, but only in one direction too the right. When i turn left it still fires right?
(Oh… In my game i only needed it to the right. So i hadn’t realized it didn’t go the other way… I will figure it out and let you know)

Also it only fires once when mousOhe is pressed. I want it to spray bullets as long as the mouse is pressed and stop when released.

And last would it be possible to add and play flipbook animation of muzzle fire, together with firing the projectile?
(Im in the process of doing this right now, once completed. I will let you know)
[/]

Thanks brother i appreciate that. I will try this out tonight and report back if i have any questions.

[= ;137747]
Hi ,

You should be able to use the transform you have to get the players rotation, which will apply to your spawned projectile.
[/]

[=LoneWolf;137787]
Thanks brother i appreciate that. I will try this out tonight and report back if i have any questions.
[/]

I have a few questions though, firing the projectile works, but only in one direction too the right. When i turn left it still fires right?
(Oh… In my game i only needed it to the right. So i hadn’t realized it didn’t go the other way… I will figure it out and let you know)

Solution that i got working

I tried out the gate node. It works, it even stops the animation if key is released which is nice.

However if i press the key just one time a bullet is also spawned, this is an issue because my gun animation takes 1,3 secs for my charachter to raise his gun ready to fire. So a bullet just flies while my character stands there.

Also the solution you suggested did not work i tried both Get Control Location and Get actor Location, but when linked to Make Transform there won’t spawn a bullet. I attached my blueprints.


Maybe it has something to do with my character rotation.
I use two different animation for left and right and use a bool variable to check is character is facing left or right.

This is very old, but this one has a related question. I’m recreating mega man x for educational purposes. Using 3 flip books for one projectile: yellow bullet (default), green blast (charging), blue blast fully (charged). How do I update collision box for the new flipbook? Right now if the flipbook updates then the original collision box breaks and blasts go through walls, no collision.


I have linked the change in the flipbook of the projectile to the damage of the projectile, which increases damage based of of the charge function. However when the flipbook changes to either the green charge shot or the blue charge shot it loses it’s collision properties, going through walls and enemies alike. How do I change/update the collision? I have tried adding extra collision components for each flipbook but don’t know how to activate it… On impact of hitting enemies I will also update the flipbook for each blast type to show impact, but first I need to know how to fix the collision. I deleted the extra collision components and other various solution attempts because there were too many to explain and I didn’t necessarily understand my own attempts.