How do I create object at a random point inside another?

Get help using Construct 2

Post » Tue Jan 31, 2017 10:15 pm

I want to create an object inside the spawnarea object, at a random point.

My thinking was:

X | random(spawnarea min, spawnarea max)
Y | random(spawnarea min, spawnarea max)

But no combination I have tried works.
B
13
S
7
G
2
Posts: 65
Reputation: 2,307

Post » Tue Jan 31, 2017 10:23 pm

Never mind, I figured it out, this is how I did it.

X random(SpawnArea.BBoxLeft,SpawnArea.BBoxRight)
Y random(SpawnArea.BBoxTop,SpawnArea.BBoxBottom)
B
13
S
7
G
2
Posts: 65
Reputation: 2,307


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, FabianB and 32 guests