Hello, I am so sorry, please forgive me for my bad English.
In the User interactions of Chapter 3: Develop on page 39 of the tutorial, “Having done that, you should be able to move the character left and right with the 'A' and 'D' keys on your keyboard if you restart the application.”
Is the 'A' and 'D' is 'D' and 'F'?
I followed your tutorial and built new folders and new files. After creating a single role, I have been reporting an error. . . Say I didn't define the global variable 'loader':
Traceback (most recent call last):
File "main.py", line 10, in
app = Main()
File "main.py", line 7, in init
self.player = Player(0, 1)
File "D:\documents\Panda3D\code\game\player.py", line 33, in init
"defend":charPath + "defend"
File "C:\Anaconda3\envs\py2\lib\site-packages\direct\actor\Actor.py", line 280, in init
self.loadModel(models, copy = copy, okMissing = okMissing)
File "C:\Anaconda3\envs\py2\lib\site-packages\direct\actor\Actor.py", line 1910, in loadModel
model = loader.loadModel(modelPath, loaderOptions = loaderOptions, okMissing = okMissing)
NameError: global name 'loader' is not defined
After joining the second role, the error is like this:
Traceback (most recent call last):
File "main.py", line 23, in
app = Main()
File "main.py", line 12, in init
self.player = Player(1, "p1")
TypeError: init() takes exactly 4 arguments (3 given)
I changed
self.player = Player(1, "p1")
self.player2 = Player(1, "p2")
to
self.player = Player(1, "p1", 1)
self.player2 = Player(1, "p2", 2)
Later, it is again the fault of the definition of the loader:
Traceback (most recent call last):
File "main.py", line 23, in
app = Main()
File "main.py", line 12, in init
self.player = Player(1, "p1", 1)
File "D:\documents\Panda3D\code\game\player.py", line 32, in init
"defend":charPath + "defend"
File "C:\Anaconda3\envs\py2\lib\site-packages\direct\actor\Actor.py", line 280, in init
self.loadModel(models, copy = copy, okMissing = okMissing)
File "C:\Anaconda3\envs\py2\lib\site-packages\direct\actor\Actor.py", line 1910, in loadModel
model = loader.loadModel(modelPath, loaderOptions = loaderOptions, okMissing = okMissing)
NameError: global name 'loader' is not defined
Maybe I didn't understand it. After all, my English is too bad. I am so sorry to bother you.
Thank you so much for your tutorial.