How to repeatedly shoot while button is held down

neoselket

  • Posts: 6
So i want to make it so my character shoots every half a second while the shoot button is held down, and stop shooting after it's released, but what happens is when i hit the shoot button, it shoots every half a second for infinity, and i can't get it to stop. I tried a different method(i forget what) and it just started the loop over every tick while the button is held down. How do i fix this?
Thank you for your time!

JeffreyDriver

  • Posts: 2262
Use a custom event instead of a loop that triggers when the button is down  and after half a second if the button is still down trigger it again

KGBlag

  • Posts: 38
Something like this should do it.


cabinfever

  • Posts: 159
Is there a problem that this keeps on creating new threads every 1/60 second?
One needs to be careful when using timed-delays.

Maybe just create custom event for key-pressed (and released), which triggers the loop (which has the delay in it).
So you can be sure, that only one thread is created.

« Last Edit: December 12, 2018, 01:05:45 am by cabinfever »

NerdinaNutshell

  • Posts: 251
Use an input event and the create actor block. I feel that it’ll be pretty self explanatory from there (if not I’ll be more than happy to help you.
*Puff*