I'm trying to limit the rate at which the player can fire to once every second and at the moment I'm simply setting a variable called Firing to 1 when the mouse button is clicked then back to 0 after one second and adding the condition that Firing must be set to 0 in order to fire. The problem is that you can often 'beat' this system by clicking the mouse really quickly, presumably because of the slight delay in changing the variable. What's the simplest way for me to ensure the limit on fire rate is absolute?
Thanks in advance!
Develop games in your browser. Powerful, performant & highly capable.
That's weird, it should not happen, cause I am sure no matter how fast we manually rapid press the button, the code will still run faster.
Perhaps you can upload a screenshot for us to take a look at those events.
one solution might be -> is in touch -> system every x seconds * firerate -> spawn playerbullet
regards
Thanks very much to you both - I will try that suggestion right away and in the meantime here is a screenshot of my current system. The subevent was just me trying a workaround - I had exactly the same problem when combining all into one event and losing the 'trigger once.'
[attachment=0:jcr1pdhm][/attachment:jcr1pdhm]
j0schi's technique worked perfectly. Thank you!
I'd still be interested to hear any insights into why mine failed though.
You don't need variables if you want just one shoot every x seconds.
mouse click
every x seconds ------------------- shoot
A0Nasser is right, but you might want to keep this for later modifyers
Hi!
I dont understand T_T
Can you show project file (about rate of fire)?
Tnx u.