How do I stop objects spawning after a set amount of time

Just started using Construct 2? Post your questions here

Post » Tue Oct 13, 2015 11:56 pm

Ok so this isn't really a big deal but when I switch to my plasma gun I have it set up so after 10 shots the bullets are destroyed every tick for 8 seconds. This is a problem because if you spam the gun 10 times then it will delete all the bullets in the layout including the ones still in the air. I want it so after 10 shots the bullets stop spawning instead of just getting destroyed every tick.

Here is my file if you want to take a look
-http://www.mediafire.com/download/2d8t0qevtu3d65q/New+folder+%282%29+%281%29.zip
B
4
Posts: 19
Reputation: 234

Post » Wed Oct 14, 2015 2:52 am

One of the ways to do it:

Add boolean instance variable to the gun, let's name it "cooldown"
and another number global variable, let's name it "Shoots"

Keyboard on Space pressed ---- Gun Spawn bullets - and add 1 to global variable
Gun Cooldown is True


System global variable = 8 ------ Set cooldown to false - wait 5 seconds - Set cooldown to true - Set global variable to 0
System trigger once
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155

Post » Wed Oct 14, 2015 3:24 am

can you explain a little better. Im sorry but my nooby brain didn't really understand
B
4
Posts: 19
Reputation: 234

Post » Wed Oct 14, 2015 3:52 am

He means something like this image I have in my dropbox:

Image

This blocks a key from being pressed for 3 seconds after it's first pressed. If you do the same with your spawn, it can only spawn ever so many seconds, preventing too many from existing at the same time.
B
240
S
62
G
33
Posts: 903
Reputation: 40,589

Post » Wed Oct 14, 2015 7:42 am

@2cool4uandme - did you look at the capx I posted in your similar post a week ago ? viewtopic.php?f=178&t=162143&p=982735#p982735
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
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Wed Oct 14, 2015 4:55 pm

ok thanks thanks guys i got what i needed
B
4
Posts: 19
Reputation: 234


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 5 guests