I’ve been using a jump task to allow my character to jump. Recently, Without changing anything to do with tasks, I now get an error. First I will show what i’m using, then I will show my error.
from direct.task import Task
class World(DirectObject):
def __init__(self):
self.accept("space", self.spacePressed)
self.jumpReady = True
def spacePressed(self):
if self.jumpReady is True:
self.jumpingTask = taskMgr.add(self.jumpingAction, "jumpingAction")
def jumpingAction(self, task):
#DoStuffNotIncluded
When I try to jump, I now get this error:
DirectStart: Starting the game.
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
Traceback (most recent call last):
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\showbase\EventManager.py", line 61, in eventLoopTask
self.doEvents()
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\showbase\EventManager.py", line 55, in doEvents
processFunc(self.eventQueue.dequeueEvent())
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\showbase\EventManager.py", line 122, in processEvent
messenger.send(eventName, paramList)
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\showbase\Messenger.py", line 388, in send
self.__dispatch(acceptorDict, event, sentArgs, foundWatch)
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\showbase\Messenger.py", line 473, in __dispatch
method (*(extraArgs + sentArgs))
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\gui\DirectButton.py", line 103, in commandFunc
apply(self['command'], self['extraArgs'])
TypeError: jumpingAction() takes exactly 2 arguments (1 given)
:task(error): Exception occurred in PythonTask eventManager
Traceback (most recent call last):
File "maincourse3.py", line 303, in <module>
run()
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\showbase\ShowBase.py", line 2630, in run
self.taskMgr.run()
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\task\Task.py", line 502, in run
self.step()
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\task\Task.py", line 460, in step
self.mgr.poll()
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\showbase\EventManager.py", line 61, in eventLoopTask
self.doEvents()
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\showbase\EventManager.py", line 55, in doEvents
processFunc(self.eventQueue.dequeueEvent())
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\showbase\EventManager.py", line 122, in processEvent
messenger.send(eventName, paramList)
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\showbase\Messenger.py", line 388, in send
self.__dispatch(acceptorDict, event, sentArgs, foundWatch)
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\showbase\Messenger.py", line 473, in __dispatch
method (*(extraArgs + sentArgs))
File "C:\Users\Britany\Desktop\Panda3D\Panda3D-1.7.2\direct\gui\DirectButton.py", line 103, in commandFunc
apply(self['command'], self['extraArgs'])
TypeError: jumpingAction() takes exactly 2 arguments (1 given)
**** End of process output ****
If i’m not mistaken,
It’s now because i’m using “self, task” which isn’t allowing me to have a second argument.
But this wasn’t a problem before. Any ideas on how to fix this? I don’t believe I changed anything around.