Random Spawning - Overlapping Check

0 favourites
  • 7 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hey everyone, so I'm trying to randomly populate a layout with trees on the start of a layout, but I don't want any of them to be overlapping. Currently on the start of the layout I run a repeat action 1000 times that creates an object at a random (X,Y) position. This (obviously) creates 1000 trees all over the place, but many of them overlap.

    I can't think how to tell them to not spawn in locations where they'd be overlapping with another object. I'd like to populate the world in a more interesting way later on with other scenery objects, and figuring this out will give me the foundations for that. But trees first. Any help would be appreciated, thanks!

    Here's a link to the playable project over on dropbox to provide some context:

    goo.gl/lwJpYj

    WASD to move, click the trees to cut them, press I to open Inventory.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try moving a tree when it collides with another tree. I've made an example for you.

  • Thanks for the quick response and the example, I haven't been able to open it up yet since apparently there's a newer version of Construct and my Steam hasn't picked it up, but I'll check it out when it's updated!

    Edit: Ah I see, you're using the beta version. Will download it to check it out, thanks!

  • Thanks for your help, here's what I got as a result:

    dl.dropboxusercontent.com/u/12286612/Survival%20Sandbox%202/index.html

  • What kind of device are u planning to run this on?

    Tried the db link on my iPad, waited 2 min for generation, then gave up.

    Will check the earlier capx when I get home

  • Here is an old example that also does forest generation. Play around with the variables for some funky results :)

    Forest generation

  • What kind of device are u planning to run this on?

    Tried the db link on my iPad, waited 2 min for generation, then gave up.

    Will check the earlier capx when I get home

    I was planning to run it on PC, but to be honest it would probably be a good mobile game. I'll have to scale it down fairly significantly for mobile devices. It was running fine on my PC, but I tried running it on a slower PC and it's pretty bad. I'll mess around with it some more later, thanks for the feedback :)

    Here is an old example that also does forest generation. Play around with the variables for some funky results :)

    I'll check out that Capx when I'm on my computer, thanks!

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