How to modify the Fire Bullet V2 to add Delay?

zidaxxx

  • Posts: 131
Hello everybody, I'm here again asking your help on this behavior.

How can i add delay in Fire Bullet to Enemy when i Press the action1 key?

because when I press the action button couple of times or spam it.  it just shoot so many times in every seconds.

so how can i make 1.5 seconds delay on this behavior? can someone help me please?

PhilIrby

  • Posts: 545
Create a Boolean attribute "canShoot"  and set default value to true.  Put all the blocks except "when action2 is pressed" inside this......

            if (canShoot)
                 set canShoot to false
                 [ do after (1.5) sec]
                 set canShoot to true
             All the rest of your behavior here
             |
             |
and put all the above inside  "when action2 is pressed"

zidaxxx

  • Posts: 131
I did what you said but it doens't work to me sir...

PhilIrby

  • Posts: 545
All of your code has to be inside of the If(canShoot) block

zidaxxx

  • Posts: 131
thank you sir, it works now. sorry because i am bad at understanding in english hehehe...
thank you again sir.

PhilIrby

  • Posts: 545
I think your sound for spear throw needs to be above the "do after" block. Otherwise your playing it 1.5 seconds after it was thrown( if you set default value of canShoot to true as I suggested )