piotr Posted October 16, 2016 Share Posted October 16, 2016 I need to hide a child sprite until it's needed, both to avoid collisions with other sprites and to not be seen on screen. If use this.scale.setTo(0,0); I get odd effects (e.g sprite seems to all over the screen, and breaks other's sprite movement). I can work around this with this.scale.setTo(0.1,0.1); so it's no problem at all. I was just wondering if is this supposed to work as intended Link to comment Share on other sites More sharing options...
drhayes Posted October 17, 2016 Share Posted October 17, 2016 You can set "sprite.visible = false;" to hide the sprite until you need it. You can also remove it from the display list (the world or its parent group) until you need it as well. Link to comment Share on other sites More sharing options...
piotr Posted October 17, 2016 Author Share Posted October 17, 2016 Hey, thanks! Didn't know about sprite visibility. Couldn't find how to remove a sprite from the display list in the documentation. How do you do that? Link to comment Share on other sites More sharing options...
samme Posted October 17, 2016 Share Posted October 17, 2016 You can do sprite.parent.removeChild(sprite); But for most cases it's probably simpler to use sprite.exists = false; instead. Link to comment Share on other sites More sharing options...
piotr Posted October 18, 2016 Author Share Posted October 18, 2016 Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts