Nesting Animating Sprites

I have a sprite of a Crocodile that tween in from the left. The only parts that actually animate are the eyes and jaw. I know it would waste memory animating the whole graphic just for the sake of two smaller areas. I want to make the jaw open on touch and then snap with eye movement.
So my question: Is it possible to create those two animated elements separately and nest them within the main tweened Croc sprite while ensuring that they can resize relative to parent, at different screen sizes?
I do hope this question makes sense.
Thanks!

Hi @Wise Old Toad,

For a case like this, you can build the “parts” of the crocodile separately and insert them into a display group. Then, you can tween the entire group, and the animated parts will stay in sync with the non-animated parts.

Note, however, that if you plan to use the physics engine and physics collisions with this object, there are some limitations with moving/scaling groups independently of objects in other groups. If that’s the case, I can recommend another approach.

Best regards,

Brent

Many thanks @Brent Sorrentino.
That’s good to know as it will solve having to animate one large sprite. I would only use physics on smaller sprites.
Cheers!

Happy to help! Just remember that if those smaller physics-based sprites will interact with the crocodile (collide with it), you’ll need to use a more comprehensive approach.

Brent

Hi @Wise Old Toad,

For a case like this, you can build the “parts” of the crocodile separately and insert them into a display group. Then, you can tween the entire group, and the animated parts will stay in sync with the non-animated parts.

Note, however, that if you plan to use the physics engine and physics collisions with this object, there are some limitations with moving/scaling groups independently of objects in other groups. If that’s the case, I can recommend another approach.

Best regards,

Brent

Many thanks @Brent Sorrentino.
That’s good to know as it will solve having to animate one large sprite. I would only use physics on smaller sprites.
Cheers!

Happy to help! Just remember that if those smaller physics-based sprites will interact with the crocodile (collide with it), you’ll need to use a more comprehensive approach.

Brent