O'Reilly logo

Panda3D 1.6 Game Engine by Dave Mathews

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - collecting garbage from the Explosion classes

We're starting with the Explosion classes because they don't create instances of any other classes. A depth-up kind of strategy is as good as any for this kind of testing.

  1. Open the ExplosionClasses_00.py file from the Chapter12 folder.
  2. Add the following method to the bottom of the Pop class:
    def __del__(self):
    print("Pop Removed")
    
  3. Add this method to the bottom of the Boom class:
    def __del__(self):
    print("Boom Removed")
    
  4. Resave the file with the same name and run the game. Watch the command prompt for our prints when Pops and Booms vanish.
  5. We don't see the prints! That's because we have two errors in our classes that need to be fixed. Firstly, we're using a Sequence to call our destroy ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required