How 2 make enemies spawn randomly, not a set interval!

Get help using Construct 2

Post » Sun Dec 13, 2015 3:11 pm

So lately ive been trying to add a ship that drops a special item but it occurs randomly, And the only thing i have is the Interval seconds, which is SET. I want mine to have random times, like it can occur anytime, not just every second.
B
6
Posts: 46
Reputation: 336

Post » Sun Dec 13, 2015 3:17 pm

Just have every second choose(0,4) for instance, then if the number is, say 4, you have the action happen. The system can randomly pick different numbers every second, but only have the action happen when one of the numbers is picked.
Last edited by Zebbi on Sun Dec 13, 2015 5:53 pm, edited 1 time in total.
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

Post » Sun Dec 13, 2015 3:28 pm

how do you do that? Can you show me a event sheet example of that? im really kindoff a nooby.
B
6
Posts: 46
Reputation: 336

Post » Sun Dec 13, 2015 3:34 pm

Every X Seconds | Spawn Enemy & set next X to int(random(1,6))

so for Every X Seconds you use a global variable, I'll call it xRandomSeconds

Every "xRandomSeconds" do
1) Spawn your enemies
2) System | set "xRandomSeconds" to int(random(1,6)) - now you have a new interval for the next spawn

Image
Last edited by Draimond on Sun Dec 13, 2015 3:45 pm, edited 1 time in total.
B
7
S
1
Posts: 43
Reputation: 513

Post » Sun Dec 13, 2015 3:44 pm

Here's a simple example: https://dl.dropboxusercontent.com/u/495 ... ntime.capx

Pick a random number (0, 1, 2, 3 or 4) every 0.5 seconds. When 4 is picked, spawn the enemy.
B
43
S
13
G
59
Posts: 1,779
Reputation: 35,731

Post » Mon Dec 14, 2015 6:39 am

thank you all for your help guys!
B
6
Posts: 46
Reputation: 336

Post » Thu Jan 07, 2016 1:56 pm

i've found a huge problem. once the varible has changed to four, instantly twelve copies of the main enemy spawns behind it, but i only want one to spawn. any help?
B
6
Posts: 46
Reputation: 336

Post » Thu Jan 07, 2016 2:30 pm

Armouredank wrote:i've found a huge problem. once the varible has changed to four, instantly twelve copies of the main enemy spawns behind it, but i only want one to spawn. any help?

+ System > If true trigger once?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

Post » Thu Jan 07, 2016 2:57 pm

hmm.. i should try that
B
6
Posts: 46
Reputation: 336


Return to How do I....?

Who is online

Users browsing this forum: Ajbael, Jhorbam and 11 guests