How do I group several objects so they follow the parent?

0 favourites
  • 7 posts
From the Asset Store
Several elements of the game interface hidden objects
  • Hi

    Is there a smart way to have several sprites grouped under one, so i can move and rotate and scale the parent and all the sprites under it will follow? Or do i have to use pin behaviour on each one and pin it in the event for every one?

    Cheers

  • You could use this plugin viewtopic.php?t=67642&start=0

    or simpler way is to create an instance variable for the child where you store the parent UID, then you could pick the parent by UID = Child.varUID and send them to that dirrection.

    I use the MoveTo in all my projects . you cand find it here http://www.scirra.com/forum/c2-plugins- ... 47002.html

  • Hi Thanks for the reply. Ive been looking the plugins over and i cant figure out how they are supposed to do what i need.

    I need to group or link several sprites to the parent/root sprite. Do when i move/rotate/scale the parent/root sprite all the other sprites will follow in their respective positions to the parent/root sprite.

    Those 2 plugins you posted, they can do that? If yes could you explain how?

    Thanks a million.

  • Omnigen It depends on what exactly you want them to behave...but you can use Pin behavior. Open C2 and the new project and search for Pin examples. You can have more types of pins: rope style, bar style, glued style

    Unfortunately the Pin behavior does not support scalling, but support angle, position

  • Yeah i know pin behaviour as i mentioned i my post hehe. But its a pain to all the time pin and unpin a lot of objects. Kinda of why i could use a group i could stick all the sprites into and then move/rotate or scale them all at the same time. :/

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use family to these child sprites and store the main sprite uid in a family instance variable and then use pin behavior in the family. For the scale(width/height) use percentage so whenever you scale the main sprite, you will have to apply the same percentage to the child sprites. This way you keep between them the same initial proportion.

  • Hmm. That sounds like it might work. I will give it a go.

    Thanks

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