Multiple spawn offsets?

0 favourites
  • 5 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • I'm working on a top down game, i have items to be picked up that are spawned randomly around the layout. The problem i keep running into is that they sometimes spawn "on top of" each other. This causes problems:

    1: looks tacky(bad)

    2: bigger objects cover up smaller ones.

    Is there a way to spawn multiple objects "at random" while avoiding Overlap?

    Thanks in advance.

  • Run another event that checks if the objects are overlapping. If they are, pick one instance and destroy it, then recreate it elsewhere.

    The only issue you'd face with this is that if the player ever sees the items spawn, then they have a chance of seeing the overlapping items for a single tick. To circumvent that issue you could give your items a fade in, active from the start, that is almost instant. That way they'll be invisible when they spawn for just a few ticks.

    Example capx.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey, thanks for the reply.

    I tried to open your link, but C2 is telling me that it was made with version 125, and mine is 119.

    I'm looking on the site, but i'm not finding 125...?

    Thanks for the logic though, I'll try it out.

  • [url=https://www.scirra.com/construct2/releases]https://www.scirra.com/construct2/releases

  • lol yeah, i just found it as you posted. Thanks though!

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