0

How do I delete every Entity that was spawned?

For example:


Entity1 = Entity(...)
Entity2 = Entity(...)
Entity3 = Entity(...)

destroy(scene.entities) # Just an example

How do I delete all those with one or multiple lines of code without appending to a list?

Trying to delete every entity that was intialized

Recentaly
  • 17
  • 4

1 Answers1

0

Use

scene.clear()

or

[destroy(e) for e in scene.entities]

Using a list comprehension can be easier than using a for loop, since it won't mess up the list while you're iterating.

pokepetter
  • 1,383
  • 5
  • 8