How To Prevent Continuous Shooting In A Single Long Button Pressed?

Discussion in 'How Can I...?' started by nyamuk91, Dec 2, 2018.

  1. nyamuk91

    nyamuk91 Boxer

    Joined:
    Aug 15, 2018
    Messages:
    95
    Likes Received:
    20
    Hi there. Is there any way to prevent shooting when Character Button is held down? I want it to only shoot 1 bullet per press.
     
  2. Marko Njegovan

    Marko Njegovan Boxer

    Joined:
    Jan 9, 2019
    Messages:
    12
    Likes Received:
    3
    Hello, did you found a solution maybe? I'm having the same problem...
     
  3. nyamuk91

    nyamuk91 Boxer

    Joined:
    Aug 15, 2018
    Messages:
    95
    Likes Received:
    20
    I ended up using Action Button instead of Character Button. Action Button has a built-in "1 action per touch" behavior. You then need to create an Action in your World which spawn the bullet. USe this Action in the Action Button.
     
    Marko Njegovan likes this.
  4. Marko Njegovan

    Marko Njegovan Boxer

    Joined:
    Jan 9, 2019
    Messages:
    12
    Likes Received:
    3
    That's my main problem, how to create an Action in World which spawns the bullet? I tried your method but with no luck because I don't know how to make an Action which spawns the bullet, I don't see any options for that.

    Thanks in advance, your help means a lot.
     
  5. nyamuk91

    nyamuk91 Boxer

    Joined:
    Aug 15, 2018
    Messages:
    95
    Likes Received:
    20
    Basically, what you need to do is
    World:
    1. Drag an image file into Buildbox and choose Action when the 'drag and drop wheel' appear. The image doesn't matter
    2. Drag another image file that you want to be your bullet into Buildbox and choose Object when the 'drag and drop wheel' appear.
    3. On the left pane, go to Action that you create from step 1 and click on Action Animation.
    4. In the Action Animation window, on the left pane, find your Bullet object and drag it into the Animation Editor.
    5. Then, you need to create a Spawner component for this object. Add velocity to this object as needed.
    UI:
    1. Create an Action Button
    2. Set the Action attribute for this button to the Action that you created earlier
    You can refer to the attached bbdoc for a working example (BB 2.3.7)
     

    Attached Files:

    Marko Njegovan and Pull Tea like this.
  6. Marko Njegovan

    Marko Njegovan Boxer

    Joined:
    Jan 9, 2019
    Messages:
    12
    Likes Received:
    3
    THANK YOU!!! Worked like a charm!
     
    nyamuk91 likes this.

Share This Page