本文整理汇总了Python中direct.particles.ParticleEffect.ParticleEffect.start方法的典型用法代码示例。如果您正苦于以下问题:Python ParticleEffect.start方法的具体用法?Python ParticleEffect.start怎么用?Python ParticleEffect.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.particles.ParticleEffect.ParticleEffect
的用法示例。
在下文中一共展示了ParticleEffect.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Smoke
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [as 别名]
def Smoke(self,model):
p1 = ParticleEffect()
p1.cleanup()
p1 = ParticleEffect()
p1.loadConfig(Filename(MYDIRPART+'smoke.ptf'))
p1.start(model)
p1.setPos(3.000, 0.000, 2.250)
示例2: SmokeRing
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [as 别名]
def SmokeRing(self,model):
p1 = ParticleEffect()
p1.cleanup()
p1 = ParticleEffect()
p1.loadConfig(Filename(MYDIRPART+'smokering.ptf'))
p1.start(model)
p1.setPos(0, 0.000, 0)
示例3: Water
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [as 别名]
def Water(self,model):
p1 = ParticleEffect()
p1.cleanup()
p1 = ParticleEffect()
p1.loadConfig(Filename(MYDIRPART+'fountain.ptf'))
p1.start(model)
p1.setPos(3.000, 0.000, 2.250)
示例4: BlockDestroyedEffect
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [as 别名]
class BlockDestroyedEffect(object):
__base = None
__pos = None
def __init__(self, base, pos):
self.__base = base
self.__pos = pos
self.particleEffect()
def particleEffect(self):
self.p = ParticleEffect()
self.loadParticleConfig('particleEffect.ptf')
self.__base.taskMgr.doMethodLater(0.5, self.stopParticles, "stop")
self.__base.taskMgr.doMethodLater(2.0, self.cleanUpParticles, "cleanup")
def cleanUpParticles(self, task):
self.p.cleanup()
def stopParticles(self, task):
self.p.softStop()
def loadParticleConfig(self, file):
self.p.cleanup()
self.p = ParticleEffect()
self.p.loadConfig(Filename(file))
self.p.setPos(self.__pos.x, self.__pos.y, 2)
self.p.start(parent = self.__base.render, renderParent = self.__base.render)
示例5: _start_pfx
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [as 别名]
def _start_pfx (self, enode, rnode, pos, radius, scale1, scale2,
lifespan, poolsize, amplitude,
texpath, color, alphamode, starttime):
pfx = ParticleEffect()
pfx.setPos(pos)
p0 = make_particles()
p0.setPoolSize(16)
p0.setPoolSize(poolsize)
p0.setBirthRate(starttime or 1e-5)
p0.setLitterSize(poolsize)
p0.setLitterSpread(0)
#p0.setSystemLifespan(1.0)
#p0.setLocalVelocityFlag(1)
#p0.setSystemGrowsOlderFlag(0)
p0.setFactory("PointParticleFactory")
p0.factory.setLifespanBase(lifespan)
p0.factory.setLifespanSpread(0.0)
#p0.factory.setMassBase(1.00)
#p0.factory.setMassSpread(0.00)
#p0.factory.setTerminalVelocityBase(400.0000)
#p0.factory.setTerminalVelocitySpread(0.0000)
p0.setRenderer("SpriteParticleRenderer")
p0.renderer.setAlphaMode(alphamode)
texture = base.load_texture("data", texpath)
p0.renderer.setTexture(texture)
# p0.renderer.setUserAlpha(alpha)
p0.renderer.setColor(color)
p0.renderer.setXScaleFlag(1)
p0.renderer.setYScaleFlag(1)
p0.renderer.setInitialXScale(scale1)
p0.renderer.setFinalXScale(scale2)
p0.renderer.setInitialYScale(scale1)
p0.renderer.setFinalYScale(scale2)
p0.setEmitter("SphereVolumeEmitter")
p0.emitter.setRadius(radius)
p0.emitter.setEmissionType(BaseParticleEmitter.ETRADIATE)
p0.emitter.setAmplitude(amplitude)
#p0.emitter.setAmplitudeSpread(0.0)
#p0.emitter.setOffsetForce(Vec3(0.0000, 0.0000, 0.0000))
#p0.emitter.setExplicitLaunchVector(Vec3(1.0000, 0.0000, 0.0000))
#p0.emitter.setRadiateOrigin(Point3(0.0000, 0.0000, 0.0000))
#f0 = ForceGroup("vertex")
#force0 = LinearVectorForce(Vec3(0.0, 0.0, -amplitude * 2))
#force0.setActive(1)
#f0.addForce(force0)
p0.setRenderParent(rnode)
#pfx.addForceGroup(f0)
pfx.addParticles(p0)
pfx.start(enode)
self._pfxes.append((pfx, lifespan, starttime))
示例6: ParticleDemo
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [as 别名]
class ParticleDemo(ShowBase):
def __init__(self):
ShowBase.__init__(self)
# Standard title and instruction text
self.title = OnscreenText(
text="Panda3D: Tutorial - Particles",
parent=base.a2dBottomCenter,
style=1, fg=(1, 1, 1, 1), pos=(0, 0.1), scale=.08)
self.escapeEvent = OnscreenText(
text=HELP_TEXT, parent=base.a2dTopLeft,
style=1, fg=(1, 1, 1, 1), pos=(0.06, -0.06),
align=TextNode.ALeft, scale=.05)
# More standard initialization
self.accept('escape', sys.exit)
self.accept('1', self.loadParticleConfig, ['steam.ptf'])
self.accept('2', self.loadParticleConfig, ['dust.ptf'])
self.accept('3', self.loadParticleConfig, ['fountain.ptf'])
self.accept('4', self.loadParticleConfig, ['smoke.ptf'])
self.accept('5', self.loadParticleConfig, ['smokering.ptf'])
self.accept('6', self.loadParticleConfig, ['fireish.ptf'])
self.accept('escape', sys.exit)
base.disableMouse()
base.camera.setPos(0, -20, 2)
base.camLens.setFov(25)
base.setBackgroundColor(0, 0, 0)
# This command is required for Panda to render particles
base.enableParticles()
self.t = loader.loadModel("teapot")
self.t.setPos(0, 10, 0)
self.t.reparentTo(render)
self.setupLights()
self.p = ParticleEffect()
self.loadParticleConfig('steam.ptf')
def loadParticleConfig(self, filename):
# Start of the code from steam.ptf
self.p.cleanup()
self.p = ParticleEffect()
self.p.loadConfig(Filename(filename))
# Sets particles to birth relative to the teapot, but to render at
# toplevel
self.p.start(self.t)
self.p.setPos(3.000, 0.000, 2.250)
# Setup lighting
def setupLights(self):
ambientLight = AmbientLight("ambientLight")
ambientLight.setColor((.4, .4, .35, 1))
directionalLight = DirectionalLight("directionalLight")
directionalLight.setDirection(LVector3(0, 8, -2.5))
directionalLight.setColor((0.9, 0.8, 0.9, 1))
# Set lighting on teapot so steam doesn't get affected
self.t.setLight(self.t.attachNewNode(directionalLight))
self.t.setLight(self.t.attachNewNode(ambientLight))
示例7: Flame
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [as 别名]
def Flame(self,model):
p1 = ParticleEffect()
p1.cleanup()
p1 = ParticleEffect()
p1.loadConfig(Filename('ee.ptf'))#'fireish.ptf'))
p1.start(model)
p1.setPos(3.000, 0.000, 2.250)
setupLights(self,model)
示例8: addEffects
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [as 别名]
def addEffects(self):
if self.mp.has_key('effects'):
base.enableParticles()
for effect in self.mp['effects']:
p = ParticleEffect()
p.loadConfig(GAME+'/particles/'+effect['file']+'.ptf')
p.start(render)
p.setPos(self.logic2terrain( effect['position'] ))
示例9: initTorchParticles
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [as 别名]
def initTorchParticles(self):
torchTops = self.level.findAllMatches("**/TorchTop*")
fxList = ['TorchSmoke.ptf', 'TorchFire.ptf']
for torch in torchTops:
for fx in fxList:
p = ParticleEffect()
p.loadConfig(Filename(fx))
p.setPos(torch.getPos(render))
p.start(self.level)
示例10: init_player
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [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
示例11: shootParticles
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [as 别名]
def shootParticles(self,collision_result):
"Summons and explosion of particles where the player shot."
# Create Particle
p = ParticleEffect()
p.loadConfig("../../models/particle_shot.ptf")
# Put particle at shot point
p.setPos(collision_result.getHitPos())
p.start(parent = self.mainRef.render, renderParent = self.mainRef.render)
# Schedule particle effect cleanup
particle_timeout = 0.2 # Time in seconds for the particle effect to fade
taskMgr.doMethodLater(particle_timeout, self.releaseParticle, 'Particle Effect Cleanup', extraArgs = [p])
示例12: __init__
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [as 别名]
class FlameTest:
def __init__(self):
self.setupLights()
self.loadItem()
self.loadParticles()
def loadItem(self):
self.itemNode = loader.loadModel('../Models/torch')
self.itemNode.setColor(Vec4(1,1,1,1))
self.itemNode.setScale(2)
self.itemNode.reparentTo(render)
self.itemNode.setPos(0,0,0)
def loadParticles(self):
base.enableParticles()
self.rFlame = ParticleEffect()
self.rFlame.loadConfig("../Models/fire.ptf")
self.rFlame.start(self.itemNode)
pos = self.itemNode.getPos()
self.rFlame.setPos(pos[0], pos[1], pos[2] + 4)
lightNode = NodePath('flame')
lightNode.reparentTo(self.rFlame)
lightNode.setZ(lightNode.getZ() + 0.5)
flame = PointLight('flame-light')
flameNP = lightNode.attachNewNode(flame)
flameNP.node().setColor(Vec4(0.9, 0.7, 0.5, 1.0))
# flameNP.node().setAttenuation(Vec3(0, 0.001, 0.000009))
flameNP.setZ(flameNP.getZ() + 0.6)
render.setLight(flameNP)
def setupLights(self):
# set up an ambient light
self.ambientLight = AmbientLight("ambientLight")
#for setting colors, alpha is largely irrelevant
# slightly blue to try and produce a wintry, snowy look
self.ambientLight.setColor((0.1, 0.1, 0.1, 1.0))
#create a NodePath, and attach it directly into the scene
self.ambientLightNP = render.attachNewNode(self.ambientLight)
#the node that calls setLight is what's illuminated by the given light
#you can use clearLight() to turn it off
render.setLight(self.ambientLightNP)
示例13: smoke_emitter
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [as 别名]
class smoke_emitter():
def __init__(self, parent, _x, _y, _z):
self.x = _x
self.y = _y
self.z = _z
self.parent = parent
self.p = ParticleEffect()
self.load_config('steam.ptf')
self.p.setScale(200)
def load_config(self, file_name):
self.p.cleanup()
self.p = ParticleEffect()
self.p.loadConfig(file_name)
self.p.start(render)
self.p.setPos(self.x, self.y, self.z)
self.p.reparentTo(self.parent)
示例14: World
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [as 别名]
class World(DirectObject):
def __init__(self):
#More standard initialization
self.accept('escape', sys.exit)
self.accept('1', self.loadParticleConfig , ['spark.ptf'])
self.accept('escape', sys.exit)
base.disableMouse()
camera.setPos(0,-20,2)
base.setBackgroundColor( 0, 0, 0 )
#This command is required for Panda to render particles
base.enableParticles()
self.t = loader.loadModel("models/stepipe")
self.t.setPos(0,0,0)
self.t.reparentTo(render)
self.setupLights()
self.p = ParticleEffect()
self.loadParticleConfig('spark.ptf')
self.p.setScale(3)
def loadParticleConfig(self, file):
#Start of the code from spark.ptf
self.p.cleanup()
self.p = ParticleEffect()
self.p.loadConfig(Filename(file))
#Sets particles to birth relative to the teapot, but to render at toplevel
self.p.start(self.t)
self.p.setPos(-2.00, 0.000, 3.150)
#Setup lighting
def setupLights(self):
ambientLight = AmbientLight("ambientLight")
ambientLight.setColor(Vec4(.4, .4, .35, 1))
directionalLight = DirectionalLight("directionalLight")
directionalLight.setDirection(Vec3( 0, 8, -2.5 ) )
directionalLight.setColor(Vec4( 0.9, 0.8, 0.9, 1 ) )
#Set lighting on teapot so spark doesn't get affected
self.t.setLight(self.t.attachNewNode(directionalLight))
self.t.setLight(self.t.attachNewNode(ambientLight))
示例15: Swarm
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import start [as 别名]
class Swarm(Unit):
'''
Subclass of Units, Tier 1 Swarm
'''
def __init__(self, host_planet, player):
'''
Constructor
@param host_planet : The planet where the unit is constructed
'''
base.enableParticles()
super(Swarm, self).__init__(host_planet, player, SWARM_VELOCITY, SWARM_MAX_ENERGY, SWARM_DAMAGE, [])
self.quad_path.setScale(2)
# self.quad_path.removeNode()
self._loadSounds("swarm")
self.model_path.setColor(Vec4(1,1,1,0.1))
self.model_path.setLightOff()
self.p = ParticleEffect()
self.p.loadConfig('models/units/swarm/swarm.ptf')
self.p.start(self.model_path)