How do I spawn objects at certain points

Get help using Construct 2

Post » Sun Oct 08, 2017 10:02 am

I was wondering how you could spawn objects in a certain way: so i want objects to spawn randomly all over the layout except a circle that follows my player so i avoid them spawning right over the player.
|_________|
|...............|
|...... O ....|
|_________| (ignore the dots)

so i tried "drawing" what i meant. i want object to spawn randomly in the rectangle (i know how to do that already) except the circle. So everywhere in the rectange but not the circle. the circle will be moving (following the player)
Thanks in advance!
B
8
S
1
Posts: 60
Reputation: 701

Post » Sun Oct 08, 2017 10:28 am

This may not be the most efficient method, but it works

Image

Note: When using While like this you need to be aware of the danger of creating an infinite loop. If there is even a slight possibility that the correct x and y coordinates will never be found (say the safeRadius is too big), you should implement some way to terminate the loop. For example a counter - exit the loop if the counter reaches 100.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
157
Posts: 2,212
Reputation: 83,505


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests