本文整理汇总了Python中direct.particles.ParticleEffect.ParticleEffect.getParticlesList方法的典型用法代码示例。如果您正苦于以下问题:Python ParticleEffect.getParticlesList方法的具体用法?Python ParticleEffect.getParticlesList怎么用?Python ParticleEffect.getParticlesList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.particles.ParticleEffect.ParticleEffect
的用法示例。
在下文中一共展示了ParticleEffect.getParticlesList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_player
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import getParticlesList [as 别名]
def init_player(self, left_btn, right_btn, player_number ,pos=(0,0,0), heading=0):
color = (configs.COLORS_MAP[player_number][0])
nodePath = loadObject()
nodePath.setPos(pos)
nodePath.setScale(configs.SCALE*0.004)
nodePath.setColor(color)
p = ParticleEffect()
p.loadConfig('textures/flare.ptf')
p.start(parent = nodePath, renderParent = render)
p0 = p.getParticlesList()[0]
p0.emitter.setRadiateOrigin(Point3(0.05*cos(heading* pi/180), 0.0, 0.05*sin(heading* pi/180)))
p.setPos(0,-1,0)
# p.setBin("unsorted", 0)
# p.setDepthTest(False)
p.setTwoSided(True)
text= TextNode('text')
text.setText(str("%s" % player_number))
text.setTextColor(color)
text.setAlign(TextNode.ACenter)
# text.font = self.font
text3d = NodePath(text)
text3d.setTwoSided(True)
text3d.setPos(nodePath, -1,-3,-4)
text3d.reparentTo(render)
circle = loadObject(tex='circle.png')
circle.reparentTo(render)
circle.setPos(nodePath, 0,-2,0)
text3d.setScale(0.13)
circle.setScale(0.09)
text3d.setColorScale(color)
circle.setColorScale(color)
new_line, line_vertex, line_node = start_new_line(self, pos[0], pos[2], color)
line_id = configs.ENTITY_ID
configs.ENTITIES[configs.ENTITY_ID] = {'CATEGORY':'line', 'GEOM':new_line, 'VERTEX':line_vertex, "NODE": line_node}
configs.ENTITY_ID += 1
speed = configs.FORWARD_SPEED
right_angle = configs.FORCE_RIGHT_ANGLE_TURN
# print left_btn
# print right_btn
self.accept(("%s" % left_btn), player_controls, [configs.ENTITY_ID, 'TURN_LEFT', 1])
self.accept(("%s-up" % left_btn), player_controls, [configs.ENTITY_ID, 'TURN_LEFT', 0])
self.accept(("%s" % right_btn), player_controls, [configs.ENTITY_ID, 'TURN_RIGHT', 1])
self.accept(("%s-up" % right_btn), player_controls, [configs.ENTITY_ID, 'TURN_RIGHT', 0])
configs.ENTITIES[configs.ENTITY_ID] = {'CATEGORY':'player','ALIVE':True, 'NODE':nodePath,'PARTICLE_PARENT':p, 'PARTICLE':p0,
'HEADING':heading, 'CURRENT_LINE':line_id, 'TICKNESS':configs.SCALE, 'TURN_LEFT':0, 'TURN_RIGHT':0, 'COLOR':color,
'PLAYER_ID':text3d, 'CIRCLE_NODE':circle, 'LEFT_ARMED':True, 'RIGHT_ARMED':True, 'PLAYER_NUMBER': player_number, 'SPEED':speed,
'RIGHT_ANGLE_TURN':right_angle }
configs.ENTITY_ID += 1
示例2: Dorf
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import getParticlesList [as 别名]
class Dorf(DirectObject):
idgen = count()
def __init__(self, pos, world):
self.id = next(Dorf.idgen)
self.world = world
self.node = loader.loadModel('media/models/dorfPH.egg')
self.text = core.TextNode('dorf')
self.text.setText('Dorf {}'.format(self.id))
self.text.setAlign(core.TextNode.ACenter)
self.text.setTextColor(1, 1, 0.5, 1)
self.text.setShadow(0.1, 0.1)
self.text.setShadowColor(0, 0, 0, 0.8)
self.textnode = self.node.attachNewNode(self.text)
self.textnode.setBillboardPointEye()
self.textnode.setPos(0, 0, 1.1)
self.textnode.setScale(0.4)
self.textnode.setDepthWrite(False)
self.textnode.setDepthTest(False)
self.textnode.setShaderOff()
self.x = int(pos.x)
self.y = int(pos.y)
self.z = 0
self.next = None
self.dir = (1, 0)
taskMgr.doMethodLater(0.5, self.move, 'Move dorf')
self.set_z(int(pos.z))
self.node.setPos(pos.x, pos.y, 0)
self.particles = ParticleEffect()
self.particles.loadConfig('media/sparks.ptf')
self.particles.reparentTo(self.node)
def set_z(self, z):
self.z = z
messenger.send('entity-z-change', [self])
def move(self, task):
if self.next:
self.x, self.y, z = self.next
self.node.setPos(self.x, self.y, 0)
if self.z != z:
self.set_z(z)
b = self.world.get_block(self.x, self.y, self.z)
if b.is_ramp:
self.node.setPos(self.x, self.y, 0.5)
else:
self.node.setPos(self.x, self.y, 0.0)
if b.is_block:
self.world.set_block(self.x, self.y, self.z, self.world.forms['Void'], 0, False)
self.particles.setPos(0, 0, 0)
self.particles.start()
for p in self.particles.getParticlesList():
p.induceLabor()
#taskMgr.doMethodLater(1.0, self.particles.disable, 'stop particling', extraArgs=[])
self.set_next()
self.node.lookAt(self.next[0], self.next[1], 0)
return task.again
def set_next(self):
x, y, z = self.x + self.dir[0], self.y + self.dir[1], self.z
if (x, y, z) not in self.world or random.random() < 0.4:
ds = [((dx, dy), (self.x + dx, self.y + dy, self.z))
for dx, dy in [(1, 0), (0, 1), (0, -1), (-1, 0)]]
self.dir, np = random.choice([(d, n) for d, n in ds if n in self.world])
x, y, z = np
b = self.world.get_block(x, y, z)
if b.is_void and not b.down.is_block:
z -= 1
self.next = (x, y, z)