How do I spawn an object a set amount of times

Just started using Construct 2? Post your questions here

Post » Wed Oct 07, 2015 1:05 am

So in my project I want the character to be able to shoot 10 times then you have to wait 10 seconds then you can fire again. When I tried to do it I made a global variable then when it reached zero it would disable the weapon, then after 10 seconds it would set the global variable 10 and reactivate the gun. It worked for the first time I could shoot 10 times then it would stop after 10 seconds it would start up again, but then it wouldn't stop after 10 seconds anymore. It would just keep shooting endlessly. Hope you can help
B
4
Posts: 19
Reputation: 234

Post » Wed Oct 07, 2015 7:20 am

I would do this with a timer attached to the player.


edit

https://goo.gl/P38jmp
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Wed Oct 07, 2015 8:19 am

I saw your file this night.
Is it possible that you use something like "IF variable = 0, THEN wait 10 seconds, THEN add x amount to variable"?
If yes, its possible that you go below 0, but the line above will only work if you exact at 0.
Try to use "equal or less" instead of "equal".
B
16
S
5
G
2
Posts: 52
Reputation: 1,662

Post » Wed Oct 07, 2015 5:37 pm

Ok so it mostly works now but after I shoot my gun 10 times and it stops for 8 seconds then the bar won't go down untill like 5 seconds after it resets

Here see for yourself:
-http://www.mediafire.com/download/4pr4isx2qp5t3g2/My+game.zip
B
4
Posts: 19
Reputation: 234


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests