Jump to content

PixiJS Delete a lot of sprites


jhon nash
 Share

Recommended Posts

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
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...