当前位置: 首页>>代码示例>>Python>>正文


Python ParticleEffect.cleanup方法代码示例

本文整理汇总了Python中direct.particles.ParticleEffect.ParticleEffect.cleanup方法的典型用法代码示例。如果您正苦于以下问题:Python ParticleEffect.cleanup方法的具体用法?Python ParticleEffect.cleanup怎么用?Python ParticleEffect.cleanup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在direct.particles.ParticleEffect.ParticleEffect的用法示例。


在下文中一共展示了ParticleEffect.cleanup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Water

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [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)
开发者ID:UIKit0,项目名称:Dota2War,代码行数:9,代码来源:Global.py

示例2: Smoke

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [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)
开发者ID:UIKit0,项目名称:Dota2War,代码行数:9,代码来源:Global.py

示例3: BlockDestroyedEffect

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [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)
开发者ID:agakax,项目名称:arkanoid,代码行数:29,代码来源:BlockDestroyedEffect.py

示例4: SmokeRing

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [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)
开发者ID:UIKit0,项目名称:Dota2War,代码行数:9,代码来源:Global.py

示例5: ParticleDemo

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [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))
开发者ID:AdrianF98,项目名称:Toontown-2-Revised,代码行数:61,代码来源:steam_example.py

示例6: Flame

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [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)
开发者ID:UIKit0,项目名称:Dota2War,代码行数:10,代码来源:Global.py

示例7: smoke_emitter

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [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)
开发者ID:daFthawk,项目名称:group-3,代码行数:19,代码来源:smoke_emitter.py

示例8: World

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [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))
开发者ID:kridily,项目名称:fall_and_fix,代码行数:45,代码来源:sparp.py

示例9: Player

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [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"))
开发者ID:MrSuborbian88,项目名称:perfumedprotector,代码行数:104,代码来源:player.py

示例10: Effects

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [as 别名]

#.........这里部分代码省略.........
		self.expTask.fps = 30                                 #set framerate
		self.expTask.obj = self.expPlane                      #set object
		self.expTask.textures = self.expTexs                  #set texture list
		#self.expPlane.node().setEffect(BillboardEffect.makePointEye())
		
		
		self.c1 = loader.loadModel("Models/Dynamite/Dynamite")
		self.c1.setPos(offset_x-6,offset_y+10,offset_z+2)
		self.c1.reparentTo(render)
		
		self.expPlane1 = loader.loadModel('Models/plane/plane')  #load the object
		#self.expPlane1.setScale(1,10,10)
		self.expPlane1.setPos(offset_x-8, offset_y+10, offset_z+3)                         #set the position
		self.expPlane1.reparentTo(render)                      #reparent to render
		self.expPlane1.setTransparency(1)
		
		self.expTexs1 = self.loadTextureMovie(50, 'explosion1/explosion','png', padding = 4)
    #create the animation task
		self.expTask1 = taskMgr.add(self.textureExplosion, "explosionTask")
		self.expTask1.fps = 30                                 #set framerate
		self.expTask1.obj = self.expPlane1                      #set object
		self.expTask1.textures = self.expTexs1                  #set texture list
		self.expPlane1.node().setEffect(BillboardEffect.makePointEye())
		
		self.orientPlane = loader.loadModel('Models/plane/plane') #Load the object
		#self.orientPlane.setScale(1)
		self.orientTex = loader.loadTexture("Models/plane/textures/carpet.jpg")
		self.orientPlane.setTexture(self.orientTex, 1)        #Set the texture
		self.orientPlane.reparentTo(render)		#Parent to render
    #Set the position, orientation, and scale
		self.orientPlane.setPosHprScale(offset_x+0, offset_y+18, offset_z, 0, -90, 0, 20, 20, 20)

	def textureMovie(self, task):
		currentFrame = int(task.time * task.fps)
		task.obj.setTexture(task.textures[currentFrame % len(task.textures)], 1)
		return Task.cont
	def textureExplosion(self, task):
		currentFrame = int(task.time * task.fps)
		#print "curr  "
		#print currentFrame%51
		if((currentFrame%len(task.textures)) > 10):
			self.c1.hide()
		elif((currentFrame%len(task.textures)) <= 0):
			self.c1.show()
		task.obj.setTexture(task.textures[currentFrame % len(task.textures)], 1)
		return Task.cont
	def takeSnapShot(self, task):
		if (task.time > self.nextclick):
			self.nextclick += 1.0 / self.clickrate
			if (self.nextclick < task.time):
				self.nextclick = task.time
			base.win.triggerCopy()
		return Task.cont
	def loadTextureMovie(self, frames, name, suffix, padding = 1):
		return [loader.loadTexture((name+"%0"+str(padding)+"d."+suffix) % i) 
        for i in range(frames)]
	def loadchar(self,main_char,txt):
		self.txt = txt
		if(txt == ''):
			self.t = loader.loadModel("Models/DJTable/DJTable")
			self.t.setPos(offset_x+0,offset_y+20,offset_z)
			self.t.setH(180)
			self.t.reparentTo(render)
			self.setupLights()
			self.loadParticleConfig('fountain2.ptf')
		else:
			self.t = main_char#loader.loadModel("Models/cat-vehicles-road/bvw-f2004--girlscar-egg/bvw-f2004--girlscar/girlcar")#loader.loadModel("Models/cat-vehicles-road/bvw-f2004--carnsx-egg/bvw-f2004--carnsx/carnsx")
			#self.t.setPos(0,20,0)
			#self.t.reparentTo(render)
			self.setupLights()
			self.loadParticleConfig('steam.ptf')
	def loadParticleConfig(self, file):
        #Start of the code from steam.ptf
		self.p.cleanup()
		self.p = ParticleEffect()
		if(self.txt == ''):
			self.txt = ''
			self.p.loadConfig(Filename(file))
			self.p.setPos(0.000, 0, 2.500)  
		elif(self.txt == 'blue'):
			self.txt = ''
			self.p.loadConfig(Filename('steam_front.ptf'))        
			self.p.setPos(0.000, -1.8, -0.800)
			
		elif(self.txt == 'red'):
			self.txt = ''
			self.p.loadConfig(Filename(file))
			self.p.setPos(0.000, 1.800, 0.250)
		self.p.start(self.t)
	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 ) )
		
		self.t.setLight(self.t.attachNewNode(directionalLight))
		self.t.setLight(self.t.attachNewNode(ambientLight)) 
#w = Effects()
#run()
开发者ID:vk92kokil,项目名称:Run-to-Live-game,代码行数:104,代码来源:effects.py

示例11: Labryn

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [as 别名]

#.........这里部分代码省略.........
    
    def placeRareCandy(self, task):
        if int(task.time) % 4 == 9 and self.candyOnBoard:
            self.candy.hide()
            self.candyOnBoard = False
        if int(task.time) % 10 ==  0 and (self.candyOnBoard == False):
            # every 10 seconds
            self.candy.setPos(MAZE.generateCandyPos())
            self.candy.show()
            self.candyOnBoard = True
        return Task.cont

    def updateTwoD(self):
        # update player candy count
        self.playerCandyStatus.destroy()
        self.playerCandyStatus = candyStatus(0, self.playerCandyCount)
        # update pikachu candy count
        # TODO
        # update my pokes color     
        if self.playerCandyCount == 0 :
            groupHide(self.myPokesBright)
            groupShow(self.myPokesDark)
            # update name
            if self.myPokeName != None:
                self.myPokeName.destroy()

    def clearRock(self):
        self.rock.hide()
        self.rockOnMaze = False
        MAZE.clearRock() # clear it in 2D

    def clearFlame(self):
        self.onFire = False
        self.flame.cleanup()
        self.pokeStatus = 0
        self.pokeMoveChoice = None
        try:
            self.myPokeName.destroy()
        except:
            pass
        self.myPokeName = None

    def clearString(self):
        self.pokeStatus = 0
        self.pokeMoveChoice = None
        try:
            self.myPokeName.destroy()
        except:
            pass
        self.myPokeName = None

        
    def timer(self, task): # deals with moves' lasting effects
        ##############################################################
        if self.rockOnMaze: # rock on maze
            self.rockCounter += 1
        elif self.rockCounter != 1: # rock not on maze, counter not cleared
            self.rockCounter = 0

        if self.onFire:
            self.fireCounter += 1
        elif self.fireCounter != 1:
            self.fireCounter = 0

        if self.pokeStatus == 2: # string shot
            self.stringCounter += 1
开发者ID:pavelkang,项目名称:Term_Project,代码行数:70,代码来源:ball.py

示例12: Demo

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [as 别名]
class Demo(ShowBase):

    def __init__(self):

        ShowBase.__init__(self)

        self.title = OnscreenText(
            text = "Panda3D : Tutorial - Particles",
            parent = self.a2dBottomCenter,
            style = 1,
            fg = (1, 1, 1, 1),
            pos = (0.06, -0.06),
            align = TextNode.ALeft,
            scale = 0.05
        )

        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.disableMouse()
        self.cam.setPos(0, -20, 2)
        self.camLens.setFov(25)
        self.setBackgroundColor(0, 1, 0)

        self.enableParticles()
        self.teapot = self.loader.loadModel("teapot")
        self.teapot.setPos(0, 10, 0)
        self.teapot.reparentTo(self.render)
        self.setupLights()
        self.particle = ParticleEffect()
        self.loadParticleConfig("steam.ptf")

        self.accept("w", self.toggle_particle)

    def toggle_particle(self):

        particleSeq = Sequence(Func(self.particle_start),
                               Wait(2),
                               Func(self.particle_end))

        particleSeq.start()

    def loadParticleConfig(self, filename):

         self.particle.cleanup()
         self.particle = ParticleEffect()
         self.particle.loadConfig("/e/Panda3D-1.9.2-x64/samples/particles/"+filename)

         #self.particle.start(self.teapot)
         self.particle.setPos(3, 0, 2.225)

    def particle_start(self):

        self.particle.start(self.teapot)

    def particle_end(self):

        self.particle.softStop()

    def setupLights(self):

        ambientLight = AmbientLight("ambiengtLight")
        ambientLight.setColor((0.4, 0.4, 0.35, 1))
        directionalLight = DirectionalLight("directionalLight")
        directionalLight.setDirection(LVector3(0, 8, -2.5))
        directionalLight.setColor((0.9, 0.8, 0.9, 1))
        directionalLight.setColor((0.9, 0.8, 0.9, 1))

        self.teapot.setLight(self.teapot.attachNewNode(directionalLight))
        self.teapot.setLight(self.teapot.attachNewNode(ambientLight))
开发者ID:ShengCN,项目名称:SeriousCode,代码行数:77,代码来源:ParticleEffectDemo.py

示例13: World

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [as 别名]
class World(DirectObject):
	def __init__(self):
		#sys.path.append('../game')
		#Standard title and instruction text
		self.title = OnscreenText(
			text="PSG: Test - Explosion",
			style=1, fg=(1,1,1,1), pos=(0.9,-0.95), scale = .07)
		self.escapeEvent = OnscreenText(
			text=HELPTEXT,
			style=1, fg=(1,1,1,1), pos=(-1.3, 0.95),
			align=TextNode.ALeft, scale = .05)

		#More standard initialization
		self.accept('escape', sys.exit)
		self.accept('1', self.loadParticleConfig , ['explosion1.ptf'])
		self.accept('2', self.loadParticleConfig , ['explosion2.ptf'])
		self.accept('3', self.loadParticleConfig , ['explosion3.ptf'])
		self.accept('4', self.loadParticleConfig , ['explosion4.ptf'])
		self.accept('5', self.loadParticleConfig , ['explosion5.ptf'])
		self.accept('6', self.loadParticleConfig , ['explosion6.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("../data/models/ship_03.egg")
		self.t.setScale(0.5)
		self.t.setHpr(180, 0, 0)
		self.t.setPos(0,10,0)
		self.t.reparentTo(render)
		self.setupLights()
		self.p = ParticleEffect()
		self.loadParticleConfig('explosion1.ptf')

	def loadParticleConfig(self,file):
		#Start of the code from steam.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(0.000, 0.000, 0.00)
	
	#Setup lighting
	def setupLights(self):
		lAttrib = LightAttrib.makeAllOff()
		ambientLight = AmbientLight( "ambientLight" )
		ambientLight.setColor( Vec4(.6, .6, .55, 1) )
		lAttrib = lAttrib.addLight( ambientLight )
		directionalLight = DirectionalLight( "directionalLight" )
		directionalLight.setDirection( Vec3( 0, 8, -2.5 ) )
		directionalLight.setColor( Vec4( 0.9, 0.8, 0.9, 1 ) )
		lAttrib = lAttrib.addLight( directionalLight )
		#set lighting on teapot so steam doesn't get affected
		#self.t.attachNewNode( directionalLight.upcastToPandaNode() )
		self.t.attachNewNode( directionalLight ) 
		#self.t.attachNewNode( ambientLight.upcastToPandaNode() )
		self.t.attachNewNode( ambientLight) 
		self.t.node().setAttrib( lAttrib )
开发者ID:crempp,项目名称:psg,代码行数:64,代码来源:particleExplosion.py

示例14: __init__

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [as 别名]

#.........这里部分代码省略.........
        render.setLight( self.light )
        ###
        self.h = loader.loadModel("../models/sphere.egg.pz")
        self.h.setPos(0, -300, 200)
        self.h.setScale(.25*1)
        self.spl = self.h.attachNewNode( Spotlight( "self.spl") )
        self.spl.node().setColor( Vec4( 5, 5, 5, 1 ) )
        #self.spl.node().setAttenuation( Vec3( 0.003, 0.003, 0.003 ) )
        self.spl.lookAt(0, 20, -200)
        
        self.h.reparentTo( pipe)
        render.setLight( self.spl)
        

    ###def addModel(self, bag):
        """Adds the model to the pipe object"""        
        ####moved to init for some reason


    def addShader(self):
        self.model.setShaderAuto()
        self.shaderEnabled = 1


    def addCollision(self):
        #Finding and adding collision tube to the pipe
        #cSphere = CollisionSphere((200,0,0), 100)
        cNode = self.nodePath.find("**/tube_collision").node()
        #cNode = CollisionNode("pipeCollision")
        #cNode.addSolid(solid)
        self.collision = self.model.attachNewNode(cNode)
        self.collision.show()


    def loadParticleConfig(self, path, file):
        #Start of the code from steam.ptf
        self.particle.cleanup()
        self.particle = ParticleEffect()
        self.particle.loadConfig(Filename(path, file))
        #Sets particles to birth relative to the teapot, but to render at toplevel
        self.particle.start(self.model)
        self.particle.setScale(100)
        self.particle.setPos(0.00, -200.000, -200.00)



    def addActionCommand(self, command):
        self.actionCommand = ActionCommand(command.__len__(), command, command)


    def destroy(self):
        #Remove particles from particle list
        #Idea: Instead of deleting particle effects, try moving them
        #to new pipe segment?
        # self.particle.cleanup()
        # self.particle.removeNode()

        #stop sound
        self.sound.setLoop(False)
        self.sound.stop()

        #remove pointLight from segment
        render.clearLight(self.light)
        render.clearLight(self.spl)
        #render.clearLight(self.plight)
        self.helper.removeNode()

        #remove pipe segment
        self.model.removeNode()

    def reactivate(self, pipe):
        print pipe.nodePath.ls()
        print "\n\n\n\n"
        self.model = pipe.model
        self.helper = pipe.helper
        self.light = pipe.light.node()
        self.shaderEnabled = 0
        self.collision = pipe.collision.node()
        #self.particle = pipe.particle
        
        #rotate by 0, 90, 180, or 270 degrees
        self.model.setR(random.randint(0,3)*90)

    def recycle(self):
        #rotate by 0, 90, 180, or 270 degrees
        self.model.setR(random.randint(0,3)*90)

        #ORANGE
        r = 1
        b = random.randint(0,91)
        g = (b / 2) + 102
        b = b / 255.0
        g = g / 255.0
        self.helper.setColor( Vec4( r, g, b, 1 ) )
        self.light.node().setColor( Vec4( r, g, b, 1 ) )
        self.actionCommand.resetCommand()

    def isCommandEmpty(self):
        print "LETS FIND OUT"
        return self.actionCommand.isEmpty()
开发者ID:kridily,项目名称:fall_and_fix,代码行数:104,代码来源:PipeWires.py

示例15: Labryn

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import cleanup [as 别名]

#.........这里部分代码省略.........
            self.candy.hide()
            self.candyOnBoard = False
            MAZE.clearCandy()
        if int(task.time) % 10 ==  0 and (self.candyOnBoard == False):
            # every 10 seconds
            self.candy.setPos(MAZE.generateCandyPos())
            self.candy.show()
            self.candyOnBoard = True
        return Task.cont

    def updateTwoD(self):
        # update player candy count
        self.playerCandyStatus.destroy()
        self.playerCandyStatus = candyStatus(0, self.playerCandyCount)
        self.pokeCandyStatus.destroy()
        self.pokeCandyStatus = candyStatus(1, self.pokeCandyCount)
        # update my pokes color     
        if self.playerCandyCount == 0 :
            groupHide(self.myPokesBright)
            groupShow(self.myPokesDark)
            # update name
            if self.myPokeName != None:
                self.myPokeName.destroy()

    def clearRock(self):
        # clear rock 
        self.rock.hide()
        self.rockOnMaze = False
        MAZE.clearRock() # clear it in 2D

    def clearFlame(self):
        # clear flame
        self.onFire = False
        self.flame.cleanup()
        self.pokeStatus = 0
        self.pokeMoveChoice = None
        try:
            self.myPokeName.destroy()
        except:
            pass
        self.myPokeName = None

    def clearString(self):
        # clear string shot
        self.pokeStatus = 0
        self.pokeMoveChoice = None
        try:
            self.myPokeName.destroy()
        except:
            pass
        self.myPokeName = None

    def clearThunder(self):
        self.onThunder = False
        try:
            self.thunder.cleanup()
        except:
            pass
        
    def timer(self, task): # deals with moves' lasting effects
        ##############################################################
        self.clock += 1
        if self.rockOnMaze: # rock on maze
            self.rockCounter += 1
        elif self.rockCounter != 1: # rock not on maze, counter not cleared
            self.rockCounter = 0
开发者ID:pavelkang,项目名称:Term_Project,代码行数:70,代码来源:ball.py


注:本文中的direct.particles.ParticleEffect.ParticleEffect.cleanup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。