jhon nash Posted March 12, 2023 Share Posted March 12, 2023 I have a contatiner with 64 children in pixiJS. Each of these 64 elements is a sprite. I want to delete 60 of these elements. How can I achieve this? When I use the forEach command for the container with a function, I can delete 30 elements. I can't delete the remaining 30 elements. How can I provide this? deleteElements(i) (this.table.children[i] as PIXI.Container).children.forEach((elm, elmI)=>{ if(elmI>4){ elm.parent.removeChild(elm); elm.destroy(); } }) }// deleted 30 sprites Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.