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:
Start by opening up
chp03_10.py
and resave it in theChapter04
folder aschp04_01.py
.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
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):
We have some extra lines in our program that aren't really necessary for what we're doing now. We should clean those up so we can focus on what's important. To start with, we should remove the second cycle from our game. Delete the following lines:
self.cycle2 = loader.loadModel("../Models/Cycle...