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 - using menus

The plan is to set up our game to have a demo race going on the start screen, and create a new race when we click a menu button. That means we'll need to be able to dynamically construct and destroy races, so we should make a Race class for that. To further expand our menu use, we'll create a confirmation dialog menu so the player can let the game know when he's ready for the race to start. Roll up those sleeves; it's time to get busy again.

  1. Open a blank document in NotePad++ and save it as RaceClass_01.py.
  2. As always, when creating a new class, we'll start with the imports. Add this code to our blank file:
    from TrackClass_01 import Track
    from CycleClass_01 import Cycle
    
  3. To get us rolling, we'll need the class definition ...

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