Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Detaching Sprite from Group so tweens don't affect it


alvatar
 Share

Recommended Posts

Hi!

 

I'm trying to figure out how to detach a sprite from a Group.

 

Currently you add it with the group as a two-step process:

1) Create the Sprite

2) Add it to the group: group.add(sprite)

 

But if I want to detach it from the group, so I can handle it individually, I have no other option than "destroy", which removes the Sprite.

Setting the parent to null doesn't work either.

The objective is that when a specific condition is met, the tween that is applied to all elements in the group as a whole doesn't apply to this particular sprite.

 

Thank you!

 

 

Link to comment
Share on other sites

Move it to another Group:

group.remove(sprite);group.add(sprite);

Remember that World is a Group. So you can do world.add(sprite) quite happily, which will keep it on the display list and rendering.

 

Removing a child from a Group does not destroy or kill it, but it WILL stop rendering if you don't add it back onto the display list somewhere.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...