Randomly spawned objects collision check problem

0 favourites
  • 1 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hi

    I've a problem that's frankly driving me nuts.

    Imagine you have a square grid 10 cells by 10 cells the centre point co-ordinates of each cell are hard mapped via an array.

    on startup I'd like to spawn I don't know .. 20 candy bars and randomly place these around the grid.

    I can do this no problem and all is well until the random position selector duplicates a position for the created candy bar.

    Nothing I can do seems to force C2 to run the checks (X overlap and x colliding) that those co-ords are occupied by another candy bar instance so the cell becomes populated with two instances.

    Any other object at all and the check works but I cannot find a way of doing what is basically an if candybar is overlapping candybar or colliding with candybar check and it does result in some grid places getting populated several times with the inevitable strange behavious associated with solids trapped inside solids... <img src="smileys/smiley18.gif" border="0" align="middle" />

    Any suggestions how I can get around this will be well received.

    Thanks!!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)