Check for no overlapping between family instances

0 favourites
  • 3 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hi folks,

    I'm trying to do something like a level editor. I want to prevent solid objects to be stacked on top of each other. I have a condition that checks if there is an overlap - in that case, the solid objects can't be placed in the level.

    But it seems I'm lacking the skill to write a condition that checks if the overlapping has stopped. I tried several versions with boolean variables and without. The stopping condition seems to fire every tick. I created a simplified version attached below (there are several hundred placeable objects in the original project, so this should really work with families). Can anyone point out to me how the condition can be fixed?

    Project: https://gofile.io/?c=9bWURJ

    Conditions:

    Editor:

    Tagged:

  • Took me a while to understand your code, and the fact that all objects are named "Sprite" didn't help :)

    Here is the fixed version, I used drag&drop behavior and a clone family:

    dropbox.com/s/uunoysubsawqzz6/Test_leveleditor.capx

    When you drop the object and it's overlapping another object, instead of destroying it you can return it to its previous location. Use a pair of instance variables to store previous x and y.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks man, the clone family is a nice workaround! I'm trying to create more of a stamp system than a drag&drop one (my capex didn't indicate that, sorry) - but it should work with the clone family. Thanks again!

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