Managing Groups of Objects

0 favourites
  • 3 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Is there a way to "Group" a few objects and treat them as one "Unit"? AND move them as one Unit keeping their relative positions to each other?

    I think this is what Containers are designed for, but my problem is I want to DRAG/DROP the "Group" as a whole and maintain each objects position to one another without custom code for each and every object. With the few things I have tried, on DRAG/DROP all the objects in the Container are positioned to the new X/Y, instead of the "primary" objects new position and their position relative to it, so fail.

    See attached .capx. You will see as you Drag the Large Green Square the two rects that "belong" to it will follow and re-position, but that is due to a every tick that is not scale-able and when one of those rects overlaps with the rect on the Red square it will accept the placement, otherwise it will throw the Big Green and its rects to a "starting" location.

    What I would like to do is make everything generic, so I don't need 8000 lines of code, one-off for if Obj1 is moved, Obj2 is moved, every tick move Obj1 and all its parts etc...

    dl.dropbox.com/u/8949954/BoxGrouping.capx

    Thanks

    Brett

  • Check out the pin behavior, seems to be what you are looking for.

    Containers are meant for object sets, that live, die and operate together. So combination of those two should be what yo are looking for :)

    To make things more generic and easier to manage, look into placing your things into single object as a separate animation/frames or using families.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Excellent, thank you. Just want I needed. I have it working and am now working on making the code more generic, making good headway on that too. Thanks again.

    Brett

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