本文整理汇总了Python中direct.controls.GravityWalker.GravityWalker.getSpeeds方法的典型用法代码示例。如果您正苦于以下问题:Python GravityWalker.getSpeeds方法的具体用法?Python GravityWalker.getSpeeds怎么用?Python GravityWalker.getSpeeds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.controls.GravityWalker.GravityWalker
的用法示例。
在下文中一共展示了GravityWalker.getSpeeds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LocalToon
# 需要导入模块: from direct.controls.GravityWalker import GravityWalker [as 别名]
# 或者: from direct.controls.GravityWalker.GravityWalker import getSpeeds [as 别名]
#.........这里部分代码省略.........
else:
self.setPlayRate(1.0, 'dneutral')
self.setAnimState('deadNeutral')
self.isMoving_side = False
self.isMoving_forward = False
self.isMoving_back = False
self.isMoving_jump = False
return
def movementTask(self, task):
if self.getMovementKeyValue('jump') == 1:
if not self.walkControls.isAirborne:
if self.walkControls.mayJump:
self.__jump()
self.hasDoneJump = True
elif self.hasDoneJump:
if self.getHealth() > 0:
self.b_setAnimState('Happy')
self.hasDoneJump = False
elif not self.walkControls.isAirborne:
if self.hasDoneJump:
if self.getHealth() > 0:
self.b_setAnimState('Happy')
self.hasDoneJump = False
return task.cont
def startTrackAnimToSpeed(self):
base.taskMgr.add(self.trackAnimToSpeed, self.uniqueName('trackAnimToSpeed'))
def stopTrackAnimToSpeed(self):
base.taskMgr.remove(self.uniqueName('trackAnimToSpeed'))
def trackAnimToSpeed(self, task):
speed, rotSpeed, slideSpeed = self.walkControls.getSpeeds()
state = None
if self.getHealth() > 0:
state = 'Happy'
else:
state = 'Sad'
if state != self.lastState:
self.lastState = state
self.b_setAnimState(state)
if state == 'Sad':
self.setWalkSpeedSlow()
else:
self.setWalkSpeedNormal()
action = self.setSpeed(speed, rotSpeed)
if action != self.lastAction:
self.lastAction = action
if action == CIGlobals.WALK_INDEX or action == CIGlobals.REVERSE_INDEX:
self.resetHeadHpr()
self.stopLookAround()
self.playMovementSfx('walk')
elif action == CIGlobals.RUN_INDEX:
self.resetHeadHpr()
self.stopLookAround()
self.playMovementSfx('run')
else:
self.resetHeadHpr()
self.startLookAround()
self.playMovementSfx(None)
return task.cont
def createLaffMeter(self):
r, g, b, _ = self.getHeadColor()
animal = self.getAnimal()