Announcement

Collapse
No announcement yet.

Spawning an 2d (flipbook) projectile

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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´╗┐

    #2
    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.

    Click image for larger version

Name:	ProjectileComp1.jpg
Views:	1
Size:	141.1 KB
ID:	1056265
    Click image for larger version

Name:	ProjectileCompGraph.jpg
Views:	1
Size:	257.4 KB
ID:	1056266
    Click image for larger version

Name:	fireweapon.jpg
Views:	1
Size:	285.0 KB
ID:	1056267
    RhinoGameHK | Twitter | Instagram

    Comment


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

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

      Edit: NVM
      Last edited by LoneWolf; 09-05-2014, 06:58 PM. Reason: Figured it out

      Comment


        #4
        Originally posted by soulmapp View Post
        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!!
        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!
        Last edited by LoneWolf; 09-05-2014, 07:03 PM.

        Comment


          #5
          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
          Click image for larger version

Name:	Untitled-1.jpg
Views:	1
Size:	162.6 KB
ID:	1056454

          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)
          RhinoGameHK | Twitter | Instagram

          Comment


            #6
            Hi everyone,

            You should be able to use the transform you have to get the players rotation, which will apply to your spawned projectile.
            Adam Davis | Marketplace Support | Epic Games
            How to report a bug? | Installation & Setup issues? | Answerhub Bug Reports | Twitter

            Comment


              #7
              Originally posted by soulmapp View Post
              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.

              Comment


                #8
                Originally posted by Adam Davis View Post
                Hi everyone,

                You should be able to use the transform you have to get the players rotation, which will apply to your spawned projectile.
                Originally posted by LoneWolf View Post
                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
                Click image for larger version

Name:	Untitled-1.jpg
Views:	1
Size:	102.0 KB
ID:	1056513
                Attached Files
                Last edited by soulmapp; 09-10-2014, 09:48 AM. Reason: Solved the issue
                RhinoGameHK | Twitter | Instagram

                Comment


                  #9
                  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.
                  Click image for larger version

Name:	Untitled-3.png
Views:	1
Size:	373.6 KB
ID:	1056707


                  Click image for larger version

Name:	Untitled-4.png
Views:	1
Size:	474.5 KB
ID:	1056708
                  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.
                  Last edited by LoneWolf; 09-14-2014, 03:17 PM.

                  Comment


                    #10
                    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.
                    Click image for larger version

Name:	Increase Ball Damage Function.png
Views:	1
Size:	271.5 KB
ID:	1130803
                    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.

                    https://answers.unrealengine.com/sto...projectile.png

                    https://answers.unrealengine.com/sto...20function.png

                    https://answers.unrealengine.com/sto...k%20change.png

                    https://answers.unrealengine.com/sto...0collision.png

                    Comment

                    Working...
                    X