How do I Spawn an Object randomly but exclude areas?

Get help using Construct 2

Post » Thu Apr 24, 2014 6:11 pm

I want to spawn an object randomly on the screen but exclude it from spawning in multiple areas on the screen, any easy way to make this happen?
B
25
S
10
G
3
Posts: 154
Reputation: 2,843

Post » Fri Apr 25, 2014 12:03 am

you don't want that the spawned sprites are overlapped?
One solution:
on creating / spawn the objects (sprites) you can check if overlapping. If so, then move the sprites randomly again. in a loop (while(!overlapping)).
B
13
S
4
G
1
Posts: 107
Reputation: 1,337

Post » Fri Apr 25, 2014 2:15 am

Hey that is a great idea, now to figure out the code.
B
25
S
10
G
3
Posts: 154
Reputation: 2,843

Post » Sat Apr 26, 2014 2:26 pm

So I get over lapping idea, but how do I say "if over lapping any object" then respawn with out specifying every object that may be in the layout.
B
25
S
10
G
3
Posts: 154
Reputation: 2,843

Post » Sat Apr 26, 2014 3:14 pm

you could add all the objects that you want to check to a family and just check if you are overlapping "family"
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Sat Apr 26, 2014 3:59 pm

I'll try that, thanks
B
25
S
10
G
3
Posts: 154
Reputation: 2,843

Post » Sat Apr 26, 2014 7:40 pm

DAG and RamPackWobble good advice. it works like a charm now. Thanks.
B
25
S
10
G
3
Posts: 154
Reputation: 2,843


Return to How do I....?

Who is online

Users browsing this forum: Fenix18, tarek2 and 54 guests