How do I set reload time ?

Get help using Construct 2

Post » Wed May 07, 2014 12:21 pm

I am trying to get my weapons to fire once every 5 secs while pressing the spacebar. I used the Wait event but as long as i keep pressing spacebar, it still keeps firing. How do i set a reload time so that even after firing, pressing the spacebar will have no effect till the 5 sec reload is up.

Thanks for any advice !
B
7
Posts: 30
Reputation: 333

Post » Wed May 07, 2014 1:11 pm

Every X seconds
Run the event regularly at a given time interval in seconds. This can also be used beneath other conditions to only run the event at a given time interval while the other conditions are true, e.g. "Player is holding spacebar AND every 0.5 seconds: fire laser".
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Wed May 07, 2014 2:13 pm

The best and easiest way to do this.
Put a var onto your player called. NextShot and make in a number.

When you fire the weapon
If(NextShot < time)
Fire the weapon stuff
NextShot = time + 5 seconds
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,013

Post » Thu May 08, 2014 10:03 pm

How to you make the var for the time? Like i set reload to 5. How to set a timer to count down to 0 so i can fire the next shot?
B
7
Posts: 30
Reputation: 333


Return to How do I....?

Who is online

Users browsing this forum: SputnikCZ and 3 guests