We're going to use the files from last chapter's Have a Go hero section to proceed. If we didn't complete that section, that's fine. Files have been provided that we can use instead.
Open the cycle class file we made during the previous chapter's Have a Go hero section, or open the file
CycleClassHero.py
in theChapter06
folder.Resave the file as
CycleClass_01.py
in theChapter06
folder.For this collision system, we're going to have a unique name for each cycle on the track. We also need to be able to put the cycles in different spots on the track so they don't start on top of each other. Change the definition of the
__init__
to look like this:def __init__(self, inputManager, track, startPos, name, ai = None):
Change the line where we call
setupVarsNPs
to accept the newstartPos
andname
information, like so:self.setupVarsNPs(startPos, name)
Naturally, we have to update
setupVarsNPs
to use this data. Replace the definition for that method with these...