How do I spawn objects at certain points

  • 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This may not be the most efficient method, but it works

    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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)