Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

562
Views
Phaser.js: How to get or remove all sprites in one scene

I used to handle a group of sprites by push them into an array or sprite group which is build-in class in the Phaser. But I am seeking another simple way could get or remove all sprites in an scene. Does anyone have any idea to resolve this? Thanks a lot!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The Scene has a property children (link to documentation)

You can get all Sprites, with the command:

// where this = the current scene
let allSprites = this.children.list.filter(x => x instanceof Phaser.GameObjects.Sprite);

And then remove/destroy them all, like this:

allSprites.forEach(x => x.destroy());

Just iterating through the list of sprites, and calling the destroy function on each object.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!