Randomly spawned objects collision check problem

Get help using Construct 2

Post » Wed Feb 12, 2014 12:44 am


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...

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

There are 10 types of people in the World, those that understand binary and those who don't.
Posts: 93
Reputation: 797

Return to How do I....?

Who is online

Users browsing this forum: Metathronos and 20 guests