本文整理汇总了Python中direct.particles.ParticleEffect.ParticleEffect.accelerate方法的典型用法代码示例。如果您正苦于以下问题:Python ParticleEffect.accelerate方法的具体用法?Python ParticleEffect.accelerate怎么用?Python ParticleEffect.accelerate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.particles.ParticleEffect.ParticleEffect
的用法示例。
在下文中一共展示了ParticleEffect.accelerate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Player
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import accelerate [as 别名]
#.........这里部分代码省略.........
self.jumping=15
self.falling=0
if self.gravity == 1 and not self.jumpingCurrently:
pos_z+=self.fall()
self._model.setZ(pos_z)
else:
if len(entries_front) > 0 and entries_front[0].getSurfacePoint(render).getZ()>self._model.getZ():
self._model.setZ(entries_front[0].getSurfacePoint(render).getZ())
self.gravity=0
self.jumpingCurrently=False
self.jumping=15
self.falling=0
if self.gravity == 1 and not self.jumpingCurrently:
pos_z+=self.fall()
self._model.setZ(pos_z)
#elif self.is_valid(entries_front) and self.is_valid(entries_back) and self.is_valid(entries_left) and self.is_valid(entries_right) and self.is_valid(entries_front_right) and self.is_valid(entries_front_left) and self.is_valid(entries_back_left) and self.is_valid(entries_back_right):
elif self.is_valid(entries_wall):
if len(entries_front) > 0 and len(entries_back) > 0:
f = entries_front[0].getSurfacePoint(render).getZ()
b = entries_back[0].getSurfacePoint(render).getZ()
#l = entries_left[0].getSurfacePoint(render).getZ()
#r = entries_right[0].getSurfacePoint(render).getZ()
z = (f + b) / 2
if abs(z - self._model.getZ()) > 5:
self.gravity=1
else:
#self._model.setZ(z)
#self._model.setP(rad2Deg(math.atan2(f - z, self._coll_dist * self._scale)))
#self._model.setR(rad2Deg(math.atan2(l - z, self._coll_dist_h * self._scale)))
pass
else:
self._model.setPos(pos)
if not self.chase and self.chasetimer < settings.PLAYER_CHASE_LENGTH:
self.chasetimer += 1
self._prev_move_time = task.time
self.inst1.destroy()
self.inst1 = addInstructions(0.95, str(self._model.getPos()))
return Task.cont
def is_valid(self, entries):
#if len(entries) == 0:
#return False
for x in entries:
if x.getIntoNode().getName()!='ground1':
return False
return True
def jump(self):
if self.jumping>0:
self.gravity=1
self.jumping-=.5
return self.jumping*.5
else:
return self.fall()
def fall(self):
self.falling-=.5
return self.falling*.5
def loadParticleConfig(self, position):
self.p.cleanup()
self.p = ParticleEffect()
self.p.loadConfig(os.path.join("models", "smokering.ptf"))
self.p.accelerate(.25)
self.p.setPos(position)
self.p.reparentTo(render)
self.p.setScale(30)
self.p.start()
#taskMgr.doMethodLater(5, self.cleanParticles, 'Stop Particles')
def cleanParticles(self, random):
self.p.softStop()
def play_dead(self):
self.playing_dead = not self.playing_dead
if self.playing_dead:
self._model.setR(self._model.getR()+10)
self._model.setZ(self._model.getZ()+1)
else:
self._model.setR(self._model.getR()-10)
self._model.setZ(self._model.getZ()-1)
def passBlocks(self, blocks):
self.blocks = blocks
def passCurrentRoom(self, currentRoom):
self.currentRoom = currentRoom
def game_over(self):
self.lose = True
taskMgr.doMethodLater(3, sys.exit, "game_over")
if self.dogSelection == 2: #small
self.a = OnscreenImage(parent=render2d, image=os.path.join("image files", "Game-Over-Screen-Small.png"))
else:
self.a = OnscreenImage(parent=render2d, image=os.path.join("image files", "Game-Over-Screen-Big.png"))