(solved) How do I Spawn Random Objects objectively?

Get help using Construct 2

Post » Sat Mar 22, 2014 6:35 pm

So I'm spawning and object on the screen say X(random (1280)),Y(random(720)) but I've got stuff in the middle of screen I don't want my object to spawn on top of. Any ideas on how to accomplish this?
Last edited by dthomasdigital on Mon Mar 24, 2014 12:19 pm, edited 1 time in total.
B
25
S
10
G
3
Posts: 154
Reputation: 2,843

Post » Sat Mar 22, 2014 6:50 pm

Why not add a condition on your spawn and move instantly the object spawned ?
For example is your object overlap a sprite at the middle of the screen move it randomly to the right/left/top bottom of the object ?
B
39
S
15
G
5
Posts: 295
Reputation: 6,089

Post » Sat Mar 22, 2014 9:41 pm

I guess you can put the overlapping condition before all the conditions. so your spawn mechanic will run correctly always.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Sat Mar 22, 2014 11:14 pm

I'll give it a try, thanks for the help, this forum always delivers.
B
25
S
10
G
3
Posts: 154
Reputation: 2,843

Post » Sat Mar 22, 2014 11:34 pm

Rather than create an object adding collision checks and resources I would use random with range...

example, random(50,200) will give a random between 50 and 200...

hope it helps...
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Sun Mar 23, 2014 2:23 pm

I'll try that too, thanks Pixel perfick, your like my best beta tester.
B
25
S
10
G
3
Posts: 154
Reputation: 2,843

Post » Mon Mar 24, 2014 12:19 pm

Creating the range was the answer and it's giving me the resulted I wanted, thanks all.
B
25
S
10
G
3
Posts: 154
Reputation: 2,843


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], jbr190 and 33 guests