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 basic HUD

That's enough talk, let's get to work. To begin with, we're only going to create the bottom-left corner of the HUD, because the items that are tracked by the rest of the HUD haven't been implemented yet. We'll build up the HUD more as we add to the game.

  1. Open another blank document in NotePad++ and save it as HUDClass_01.py.
  2. Once again, our imports come first. Add the following code to our blank file:
    from direct.gui.DirectGui import *
    from pandac.PandaModules import *
    
  3. After that, we need the class definition and the __init__ method. Here's the code for it:
    class HUD: def __init__(self, fonts): self.modTS = TextureStage("Modulate") self.modTS.setMode(TextureStage.MModulate) self.createLLHUD(fonts) self.visible ...

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