Created objects overlapping question.

Get help using Construct 2

Post » Thu Oct 03, 2013 9:22 pm

Say you are creating and randomly placing several instances of the same base object. How would you detect an overlap between the current (picked) instance and another instance previously placed?
I tried the obvious condition "Object is overlapping Object" condition, but it never triggers, though overlaps are definitely happening.
Edit: I should mention that the objects are being created in a loop, so detection should go in there.Yttermayn2013-10-03 21:26:57
B
11
S
4
G
1
Posts: 159
Reputation: 1,803

Post » Thu Oct 03, 2013 10:19 pm

You can sort of do what you want with families (put the object in a family and then do Object is overlapping Family), however you'll still run into the problem with this in a loop, because the sprite that was just created isn't available yet when the event to do the overlap check is called.

I would have thought that using the Object's "on created" event and doing the collision check in there would have worked, as I assume when that event fires then you are guaranteed that the sprite exists. However, when I did a test, it only partially worked. Perhaps it isn't guaranteed to be put in a family before the "on created" event fires?

http://storage.wertle.com/construct2/Overlapping%20issues.capx

B
11
S
2
Posts: 87
Reputation: 1,112

Post » Fri Oct 04, 2013 2:22 pm

Good info, thanks. I'll see if I can change things around to give the new instance a chance to appear before the check. Ill also look into families. Thank you!
B
11
S
4
G
1
Posts: 159
Reputation: 1,803

Post » Fri Oct 04, 2013 6:44 pm

search Evil Sprites in the forum
@Yttermaynghost2013-10-04 18:44:25
B
12
S
3
G
1
Posts: 347
Reputation: 2,866

Post » Sun Oct 06, 2013 4:18 pm

Ooh, ghost. Now THAT looks helpful. Thank you!!!
B
11
S
4
G
1
Posts: 159
Reputation: 1,803


Return to How do I....?

Who is online

Users browsing this forum: kizlengames, WesleyDeveloper9 and 6 guests