WiLD11 Posted April 6, 2016 Share Posted April 6, 2016 Hello, I have been trying to figure something out for a while now. So, I have a player who catches things from above, once he catches something it gets stacked on his hand. Those things which are stacked are in a group called Slices. What I want to do is when the player hits the number of 3 Slices the group gets reset back to 0 (so there would be no more stacked slices) and then continue with the stacking from 0. Sorry if the explanation is bad :\ I will try to clear it out more if you have any questions Thanks! WombatTurkey 1 Link to comment Share on other sites More sharing options...
WombatTurkey Posted April 6, 2016 Share Posted April 6, 2016 You can just call kill or destroy on the group? It will remove all children sprites. Call kill on it when the player's value hit's 3 maybe? Not sure Link to comment Share on other sites More sharing options...
WiLD11 Posted April 6, 2016 Author Share Posted April 6, 2016 Just now, WombatTurkey said: You can just call kill or destroy on the group? It will remove the childrenized sprites. That would not work. As that would destroy the group in its entirety. All I want to do is kind of reset it to 0 children WombatTurkey 1 Link to comment Share on other sites More sharing options...
WombatTurkey Posted April 6, 2016 Share Posted April 6, 2016 11 minutes ago, WiLD11 said: That would not work. As that would destroy the group in its entirety. All I want to do is kind of reset it to 0 children try something like this when your player hits 3 of whatever value ( if Slices is your group name ) for(var i =0; i < 3; i++){ Slices.children[i].kill() } WiLD11 1 Link to comment Share on other sites More sharing options...
WiLD11 Posted April 6, 2016 Author Share Posted April 6, 2016 1 minute ago, WombatTurkey said: try something like this, if Slices is your group var slices = Slices.children; for(var i =; i < 3; i++){ Slices.children[i].kill() } That worked perfectly, thank you so much! WombatTurkey 1 Link to comment Share on other sites More sharing options...
WombatTurkey Posted April 6, 2016 Share Posted April 6, 2016 2 minutes ago, WiLD11 said: That worked perfectly, thank you so much! Lol, great! I just threw that code out there! Edit: Oops, you can remove the ` var slices = `, no idea why I did that, habbit WiLD11 1 Link to comment Share on other sites More sharing options...
WiLD11 Posted April 6, 2016 Author Share Posted April 6, 2016 Yup, haha Realised that. Thanks! WombatTurkey 1 Link to comment Share on other sites More sharing options...
Recommended Posts