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 - creating a preloader to load models

Let's get a feel for how this works by creating a preloader to load our models before the game starts.

  1. Create a blank new file in Notepad++. Save it as PreloaderClass_01.py. Then, add these two import lines to the top of the file:
    from direct.gui.DirectGui import *
    from pandac.PandaModules import *
    
  2. It would be easy to just have the preloader load the models and be done with it, but that wouldn't be any different than having a black screen when the game loads. We'd accomplish nothing. We need our preloader to show the loading progress, and that means we need to create some GUI elements. Add in the class definition and __init__ method, and have them look like this:
    class Preloader: def __init__(self, ...

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