Im trying to learn about Finite State Machines (FSM) and have followed the manual closely, yet when I try to request my state from my FSM class, it always returns an error:
So I tried to use forcetransition, and error:
here is moveFSM:
from direct.fsm import FSM
class AvatarFSM(FSM.FSM):
def __init__(self):#optional because FSM already defines __init__
#if you do write your own, you *must* call the base __init__ :
FSM.FSM.__init__(self,'avatarFSM')
##do your init code here
def enterWalk(self):
self.player.loop('walk')
self.walksound.play()
def exitWalk(self):
self.player.stop()
self.walksound.stop()
def enterJump(self):
self.player.loop('jump')
self.walksound.play()
def exitJump(self):
self.player.stop()
self.walksound.stop()
movefsm = AvatarFSM()
and here is the pertinent main.py info:
import movefsm
import direct.directbase.DirectStart
from direct.actor.Actor import Actor
from direct.fsm import FSM
def move(self, task):
if (self.keyMap["jump"]!=0):
movefsm.request('Jump')
Any suggestions on why it wont use the FSM commands?