How do I Put a delay on random spawning objects?

Just started using Construct 2? Post your questions here

Post » Sun Jan 11, 2015 9:15 pm

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
B
6
S
1
Posts: 10
Reputation: 370

Post » Sun Jan 11, 2015 9:52 pm

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
ImageImage
B
114
S
51
G
24
Posts: 790
Reputation: 23,480

Post » Sun Jan 11, 2015 9:54 pm

Wait.PNG


Does that work for what you need?

(spawning instead of moving of course.)
You do not have the required permissions to view the files attached to this post.
B
241
S
63
G
33
Posts: 903
Reputation: 40,729

Post » Mon Jan 12, 2015 4:04 am

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:
You do not have the required permissions to view the files attached to this post.
B
6
S
1
Posts: 10
Reputation: 370

Post » Mon Jan 12, 2015 6:26 pm

Run fine in my case below:
Image

Does the ENEMIES Group is activated from first place?
ImageImage
B
114
S
51
G
24
Posts: 790
Reputation: 23,480

Post » Mon Jan 12, 2015 11:10 pm

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.
B
6
S
1
Posts: 10
Reputation: 370

Post » Thu Jan 15, 2015 7:33 pm

Dliu3d wrote: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.
ImageImage
B
49
S
15
G
2
Posts: 270
Reputation: 6,679

Post » Fri Jan 16, 2015 3:55 am

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.
You do not have the required permissions to view the files attached to this post.
B
7
S
1
G
1
Posts: 4
Reputation: 422


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest