How do I Put a delay on random spawning objects?

0 favourites
  • 8 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • How do I put a wait on random spawning enemies so that on the start of the layout they don't drop into the screen immediately? My enemy objects have a bullet behavior and are set to spawn every 3 seconds which is what I want except for the start of the layout.

    Thanks

  • Create a global variable "state" then leave it to 0

    On start of layout | wait 5 secs then set variable "state" to 1

    Add extra condition within spawning events occur

    "state" =1 & every 3 secs | spawn enemy

  • [attachment=0:3a2vde2s][/attachment:3a2vde2s]

    Does that work for what you need?

    (spawning instead of moving of course.)

  • Hmm, so still the same issue, On the start of layout, the enemies drop in once then the delay kicks in and then they start spawning. I'm trying to follow the directions but I'm not sure if I'm doing it right.

    Here's what my event sheet looks like:

  • Run fine in my case below:

    Does the ENEMIES Group is activated from first place?

  • Ohhhh...ok I got it working now. What I was missing was the event object is outside layout --> destroy, without that my enemies kept spawning on layout.

    Thanks bros.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ohhhh...ok I got it working now. What I was missing was the event object is outside layout --> destroy, without that my enemies kept spawning on layout.

    Thanks bros.

    If you want to make your life a little easier, there's also a behaviour you can apply which does this for you.

  • You can use the 'Compare Time' function, and add it as an extra condition for the 'Every X Seconds' Event.

    This way, you have saved some time and an extra event line.

    Here's a screenshot of what I did in my practice project. What it does is that it does 'Something' every 30 seconds after at least 90 seconds has passed in-game. You'll just have to change the values, and it should work as you intended.

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