playMaker

Author Topic: How to make hold button shooting[SOLVED]  (Read 1365 times)

QueenM56

  • Junior Playmaker
  • **
  • Posts: 55
    • View Profile
How to make hold button shooting[SOLVED]
« on: June 10, 2018, 05:10:38 AM »
Hi all,

I'd like to create a 'hold button shooting' function for my game.
I'm currently using 'get key down' and 'spawn bullets', but it only spawns one bullet each time. Is there any way I can make continuous bullets until the button is up?
Please, anyone can help?

Thanks!
M
« Last Edit: June 11, 2018, 09:37:30 AM by djaydino »

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 1119
    • View Profile
    • Fat Pug Studio
Re: How to make hold button shooting
« Reply #1 on: June 10, 2018, 06:19:27 AM »
Put wait as the last action, and loop the state into itself. Wait time will be your rate of fire basically.

terri

  • Sr. Member
  • ****
  • Posts: 376
    • View Profile
    • terrivellmann.tumblr.com
Re: How to make hold button shooting
« Reply #2 on: June 10, 2018, 07:07:58 AM »
Don't use get key down though in this case, I think it won't trigger if you enter the state with it held down?
Use get key followed by a bool compare action

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 1119
    • View Profile
    • Fat Pug Studio
Re: How to make hold button shooting
« Reply #3 on: June 10, 2018, 09:26:06 AM »
Yeah, forgot about that.

QueenM56

  • Junior Playmaker
  • **
  • Posts: 55
    • View Profile
Re: How to make hold button shooting
« Reply #4 on: June 10, 2018, 10:16:49 PM »
Thanks for the suggestions krmko and Terri.
I did try set bool value after 'get key down', but the problem is it starts to loop in infinite bullet shoot once I set the bool value to true.
I haven't found an effective way to set the bool value back to false.
Does anyone know how to solve it?

Cheers,
M

QueenM56

  • Junior Playmaker
  • **
  • Posts: 55
    • View Profile
Re: How to make hold button shooting
« Reply #5 on: June 10, 2018, 11:03:59 PM »
Hi guys, the 'get key' set bool value works!
Thank you so much!
M