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 - registering and responding to events

We need to make several changes to our code to make this work. We should be extra careful when following these directions to avoid making a mistake:

  1. Start by opening up chp03_10.py and resave it in the Chapter04 folder as chp04_01.py.
  2. The first thing we need to do is import DirectObject so that we can inherit from it. Add the following line to your program below the very first line. This is case sensitive, so make sure to type it correctly.
    from direct.showbase.DirectObject import DirectObject
    
  3. Once we have that, we need to change the way we're creating our World class. Change the class definition line to the following:
    class World(DirectObject):
    
  4. We have some extra lines in our program that aren't ...

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