kuk Posted January 29, 2015 Share Posted January 29, 2015 Can i move sprite from group to another group? Link to comment Share on other sites More sharing options...
Daniel Belohlavek Posted January 30, 2015 Share Posted January 30, 2015 You can save the sprite in a variable, then do group1.add(sprite) or group2.add(sprite). The same way you can remove the sprite from any group. Removing the sprite from one group and adding it to another would be the same as moving. Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted January 30, 2015 Share Posted January 30, 2015 If you want a piece of code : [Edited after InsaneHero's comment]var oldParent = sprite.parent;oldParent.remove(sprite);newParent.add(sprite); Link to comment Share on other sites More sharing options...
InsaneHero Posted January 31, 2015 Share Posted January 31, 2015 I think that should be: oldParent.remove(sprite); and that could be reduced to: sprite.parent.remove(sprite); Eliminating the need for the local variable. Link to comment Share on other sites More sharing options...
Daniel Belohlavek Posted January 31, 2015 Share Posted January 31, 2015 Off-topic: There's an alien, a pirate, a Mexican and a hero in this thread. There's an awesome game idea! Congratulations pandavigoureux29 1 Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted February 2, 2015 Share Posted February 2, 2015 @InsaneHero : Thks and sorry, I used a code of mine that had different variables names and mix them while editing them. Link to comment Share on other sites More sharing options...
Recommended Posts