How do I move a Container as one?

Get help using Construct 2

Post » Sat May 24, 2014 2:56 am

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?
B
4
Posts: 8
Reputation: 241

Post » Sat May 24, 2014 5:03 pm

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.
B
43
S
12
G
6
Posts: 446
Reputation: 6,807

Post » Sun May 25, 2014 1:07 am

Thanks for that. I actually hadn't come across the Pin concept anywhere thus far. Useful stuff.
B
4
Posts: 8
Reputation: 241


Return to How do I....?

Who is online

Users browsing this forum: Pandy, Uglypenguin and 6 guests