hollowdoor Posted February 8, 2015 Share Posted February 8, 2015 When a parent is killed there is no killed event on children. There's a destroy event on children so I don't understand how children don't get the other event. There's an effect I want to happen on children when a parent sprite gets killed. There are options I can think of like manually killing the children when the parent is killed, but I'd much rather have phaser handle the killed event. Is there something I'm overlooking like maybe a property flag? I'm kind of wanting the the children to be a part of the parent. Link to comment Share on other sites More sharing options...
John Posted February 8, 2015 Share Posted February 8, 2015 You're not overlooking anything. Probably the best way is to setup an onKilled event on your parent sprite, then iterate each of the children in that. Link to comment Share on other sites More sharing options...
hollowdoor Posted February 8, 2015 Author Share Posted February 8, 2015 You're not overlooking anything. Probably the best way is to setup an onKilled event on your parent sprite, then iterate each of the children in that. Ok thanks. I solved it already any way. I just placed the child on a property of the parent so I could just call methods on the child sprite when the parent sprite gets killed. A property works will because the effect is only on one child. It also helps because a property with no data is a good place to check if effects will happen. Something else I learned is calling kill on a child sprite doesn't work, and the onKilled event can't be dispatched on the child. I suppose sprites can only really be killed directly in the game without a parent sprite. I could just add the kill method on the extended sprite, but what ever. Link to comment Share on other sites More sharing options...
Recommended Posts