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 World Object

  1. Edit your .py file to look like this:
    Time for action - creating a World Object
  2. Save the file as "chp02_02.py" in the same directory.
  3. Run this python file the same way you ran chp02_01.py.

What just happened?

A number of things are going on there, so we'll take a moment and talk about them.

First, we used the class command to create a new class called World.

class World:

In Python, code is grouped by using indentation. In order to tell Python we're starting a new group of indented code we end the line with a colon. We can't just throw colons where ever we want, though. They need to follow specific commands. We'll see more uses of colons as we continue ...

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