How do I move a Container as one?

0 favourites
  • 3 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • Hello,

    I have characters with identical sets of sprites (body, clothes, hair). It seems like the thing to do in such situations is to collect them all into Containers. Easy enough, and the spawning/despawning works fine.

    From there, however, I can't get the set of sprites to move as one. I thought that was one of the features of a Container, but every time I try to pick an instance of something inside the container, only that picked sprite gets updated.

    I've added the sprites in the Container to a Family, and have tried speaking to just that Family. This does seem to speak to all of them as one, but if I try to randomize the position, I end up scattering all the Container's sprites.

    I found a workaround by declaring a local variable, randomizing that, and setting the family Y to it, but am I fundamentally misunderstanding how Containers and Families work?

    I should mention that I was originally tucking only the parent sprite of the Container into a Family (I have several unique Containers doing the same thing), and having all the child sprites in that family seems like it would cause serious Instance Variable bloating. Am I wrong in theory there too?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • all containers do is pick objects together. so they create and destroy together, and when you reference an object in event sheet and it belongs together, they are picked as such. and that's it.

    Containers (manual entry)

    if you want then to move together, you'll need to use the pin behavior or something similar.

  • Thanks for that. I actually hadn't come across the Pin concept anywhere thus far. Useful stuff.

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