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

  • 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

  • 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

  • can you explain a little better. Im sorry but my nooby brain didn't really understand

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • He means something like this image I have in my dropbox:

    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.

  • 2cool4uandme - did you look at the capx I posted in your similar post a week ago ?

  • ok thanks thanks guys i got what i needed

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)