Created objects overlapping question.

0 favourites
  • 5 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • 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.

  • 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?

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

  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • search Evil Sprites in the forum

    Yttermayn

  • Ooh, ghost. Now THAT looks helpful. Thank you!!!

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