Example #1
0
    def pipeCollide(self, cEntry):
        self.numCollisions += 1
        print self.numCollisions
        #print cEntry.getIntoNodePath().getParent().getParent().getName()
        #print "\n\n\n"
        modelKey = cEntry.getIntoNodePath().getParent().getParent().getKey()
        self.currentPipe = self.getPipe(modelKey)
        if self.currentPipe.actionCommand.isEmpty() == False:
            print "Pipe Action Command = " + str(self.currentPipe.actionCommand.getCommand())
            self.currentActionCommand = ActionCommand(2,"",self.currentPipe.actionCommand.getCommand())
            print "Player Action Command = " + str(self.currentActionCommand.getCommand())
            self.currentPipe.actionCommand.blankCommand()
            print "Player Action Command = " + str(self.currentActionCommand.getCommand())

            print "------!!!!!!!!!!!!!------"

            if self.TimerGoing == False:
                self.TimeLeft = self.DefaultTime
                self.TimerGoing = True
Example #2
0
 def updateTimer(self,task):
     if self.TimerGoing == True:
         self.TimeLeft = self.TimeLeft - globalClock.getDt()
         if self.TimeLeft <= 0:
             print"-----------TIME UP!!!!!!!!!---------"
             print self.currentActionCommand.getCommand()
             if self.currentActionCommand.isEmpty() == False:
                 self.playerStability = self.playerStability - 10
                 if self.playerStability <= 0:
                     if self.GameOver == False:
                         #REPLACE TITLE.PNG WITH THE GAME OVER IMAGE!!!!!!
                         self.gameOverScreen = OnscreenImage(image = '../images/GameOver.png', scale = (1.3333333,1,1))
                         self.gameOverScreen.setTransparency(TransparencyAttrib.MAlpha)
                         self.GameOver = True
                         self.Hud.hide = True
             print "***Blanked Action Command***"
             self.currentActionCommand = ActionCommand(0,"")
             self.TimeLeft = self.DefaultTime
             self.TimerGoing = False
     return Task.cont  
Example #3
0
class PipeWires:
    """
    Creates self contained pipe objects with methods that create,
    reference, and destroy models, collision tubes, lights,
    particles, and ActionCommand sequences.
    """



    def __init__(self):

        #SoundIntervals
        #base = ShowBase()
        self.sound = loader.loadSfx("../audio/sparks.wav")
        self.sound.setLoop(True)
        self.sound.play()

        #pick file
        self.fileName = "../models/tunnelwires"
        
        #load model
        self.model = loader.loadModel(self.fileName)
        self.model.setScale(.0175)
        #print self.model.ls()

        self.nodePath = NodePath(self.model)
        self.model.reparentTo(render)
        self.key = self.model.getKey()


        ##self.addModel(bag)
        self.addPointLight(self.model)
        self.shaderEnabled = 0
        #self.addShader()        
        #self.addCollision()
        ##self.addParticle(self.model)

        base.enableParticles()

        self.particle = ParticleEffect()
        self.loadParticleConfig('../models/', 'spark.ptf')
        #self.loadParticleConfig("spark.ptf")

        self.addActionCommand("ru")
        self.type = "wires"

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

    def addPointLight(self, pipe):
        """create a point light for pipe"""

        #The redpoint light and helper
        #RED
        # r = random.uniform(700, 900) / 1000
        # g = random.uniform(0, 300) / 1000
        # b = g

        #ORANGE
        r = 1
        b = random.randint(0,91)
        g = (b / 2) + 102
        b = b / 255.0
        g = g / 255.0
        self.helper = loader.loadModel("../models/sphere.egg.pz")

        self.helper.setColor( Vec4( r, g, b, 1 ) )
        self.helper.setPos(pipe.getPos())
        #print self.helper.getColor()

        #This is value is irrelevent at the moment unless I move the lights
        self.helper.setScale(.25*1) #must be greater than 0.001


        #optionally set location of light within pipe
        self.helper.setY(self.helper.getY()-50*35 ) #moves to inbetween segments
        self.helper.setZ(self.helper.getZ()-50*6 ) #makes 3 sided lights

        self.light = self.helper.attachNewNode( PointLight( "self.light" ) )
        self.light.node().setAttenuation( Vec3( .1, 0.04, 0.1 )/2.5 )
        self.light.node().setColor( Vec4( r, g, b, 1 ) )
        self.light.node().setSpecularColor( Vec4( 1 ) )
        self.helper.reparentTo( pipe )
        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()
Example #4
0
 def addActionCommand(self, command):
     self.actionCommand = ActionCommand(command.__len__(), command, command)
Example #5
0
    def StartGame(self):

        self.titleScreen.destroy()
        #turn off default mouse control
        base.disableMouse()
        #add update tasks to taskManager
        taskMgr.add(self.keyEvents, "keyEventTask")        
        taskMgr.add(self.checkPipes2, "checkPipesTask")
        taskMgr.add(self.loopMusic, "loopMusicTask")
        taskMgr.add(self.updateTimer, "timeTask")
        
        #Enables particle effects
        base.enableParticles()
        
        camera.setPosHpr(0, -18, 3, 0, 0, 0)
        self.keyMap = {"moveLeft":0, "moveRight":0, "moveUp":0, "moveDown":0, "drop":0, \
        "actionLeft":0, "actionRight":0, "actionDown":0, "actionUp":0}
        self.prevTime = 0
        
        #Sets initial collision state, will change name later
        self.numCollisions = 0
        self.currentPipe = False
        
        self.loadModels()            
        self.setupLights()                
        #self.loadSound()                
        self.setupCollisions()
      
        self.accept("escape", sys.exit) #message name, function to call, (optional) list of arguments to that function
        #useful interval methods:
        # loop, pause, resume, finish
        # start can optionally take arguments: starttime, endtime, playrate
        
        
        #for "continuous" control
        self.accept("space", self.setKey, ["drop", 0]) #disables debug stopping
        self.accept("space-up", self.setKey, ["drop", 0])
        
        self.accept("arrow_up", self.setKey, ["actionUp", 1])
        self.accept("arrow_down", self.setKey, ["actionDown", 1])
        self.accept("arrow_left", self.setKey, ["actionLeft", 1])
        self.accept("arrow_right", self.setKey, ["actionRight", 1])
        self.accept("arrow_up-up", self.setKey, ["actionUp", 0])
        self.accept("arrow_down-up", self.setKey, ["actionDown", 0])
        self.accept("arrow_left-up", self.setKey, ["actionLeft", 0])
        self.accept("arrow_right-up", self.setKey, ["actionRight", 0])
        
        self.accept("w", self.setKey, ["moveUp", 1])
        self.accept("s", self.setKey, ["moveDown", 1])
        self.accept("a", self.setKey, ["moveLeft", 1])
        self.accept("d", self.setKey, ["moveRight", 1])
        self.accept("w-up", self.setKey, ["moveUp", 0])
        self.accept("s-up", self.setKey, ["moveDown", 0])
        self.accept("a-up", self.setKey, ["moveLeft", 0])
        self.accept("d-up", self.setKey, ["moveRight", 0])
        
        self.accept("spider-and-tube_collision", self.pipeCollide)
        
        self.DefaultTime = 1#.8
        self.TimeLeft = self.DefaultTime
        self.TimerGoing = False
        
        #Set game over thing
        self.GameOver = False

        #Set gameplay variables to keep track of
        self.gameScore = 0
        self.playerStability = 100
        self.currentActionCommand = ActionCommand(0,"")
        self.currentActionCommand.isEmpty()

        #Create HUD and add it to task thing
        self.Hud = GameHUD()
        taskMgr.add(self.update_game_Hud, "updateHudTask")

        #Fog and changing background
        myFog = Fog("Fog Name")
        f = 0.05
        myFog.setColor(f,f,f)
        myFog.setExpDensity(.01)
        render.setFog(myFog)
        base.setBackgroundColor(f,f,f)
Example #6
0
class World(DirectObject): #necessary to accept events
    def __init__(self):
        print "START THE GAAAAAME!"
        self.accept("space", self.StartGame)
        self.titleScreen = OnscreenImage(image = '../images/Title.png', scale = (1.3333333,1,1))
        self.titleScreen.setTransparency(TransparencyAttrib.MAlpha)
        self.loadSound()
        
        
                

    def StartGame(self):

        self.titleScreen.destroy()
        #turn off default mouse control
        base.disableMouse()
        #add update tasks to taskManager
        taskMgr.add(self.keyEvents, "keyEventTask")        
        taskMgr.add(self.checkPipes2, "checkPipesTask")
        taskMgr.add(self.loopMusic, "loopMusicTask")
        taskMgr.add(self.updateTimer, "timeTask")
        
        #Enables particle effects
        base.enableParticles()
        
        camera.setPosHpr(0, -18, 3, 0, 0, 0)
        self.keyMap = {"moveLeft":0, "moveRight":0, "moveUp":0, "moveDown":0, "drop":0, \
        "actionLeft":0, "actionRight":0, "actionDown":0, "actionUp":0}
        self.prevTime = 0
        
        #Sets initial collision state, will change name later
        self.numCollisions = 0
        self.currentPipe = False
        
        self.loadModels()            
        self.setupLights()                
        #self.loadSound()                
        self.setupCollisions()
      
        self.accept("escape", sys.exit) #message name, function to call, (optional) list of arguments to that function
        #useful interval methods:
        # loop, pause, resume, finish
        # start can optionally take arguments: starttime, endtime, playrate
        
        
        #for "continuous" control
        self.accept("space", self.setKey, ["drop", 0]) #disables debug stopping
        self.accept("space-up", self.setKey, ["drop", 0])
        
        self.accept("arrow_up", self.setKey, ["actionUp", 1])
        self.accept("arrow_down", self.setKey, ["actionDown", 1])
        self.accept("arrow_left", self.setKey, ["actionLeft", 1])
        self.accept("arrow_right", self.setKey, ["actionRight", 1])
        self.accept("arrow_up-up", self.setKey, ["actionUp", 0])
        self.accept("arrow_down-up", self.setKey, ["actionDown", 0])
        self.accept("arrow_left-up", self.setKey, ["actionLeft", 0])
        self.accept("arrow_right-up", self.setKey, ["actionRight", 0])
        
        self.accept("w", self.setKey, ["moveUp", 1])
        self.accept("s", self.setKey, ["moveDown", 1])
        self.accept("a", self.setKey, ["moveLeft", 1])
        self.accept("d", self.setKey, ["moveRight", 1])
        self.accept("w-up", self.setKey, ["moveUp", 0])
        self.accept("s-up", self.setKey, ["moveDown", 0])
        self.accept("a-up", self.setKey, ["moveLeft", 0])
        self.accept("d-up", self.setKey, ["moveRight", 0])
        
        self.accept("spider-and-tube_collision", self.pipeCollide)
        
        self.DefaultTime = 1#.8
        self.TimeLeft = self.DefaultTime
        self.TimerGoing = False
        
        #Set game over thing
        self.GameOver = False

        #Set gameplay variables to keep track of
        self.gameScore = 0
        self.playerStability = 100
        self.currentActionCommand = ActionCommand(0,"")
        self.currentActionCommand.isEmpty()

        #Create HUD and add it to task thing
        self.Hud = GameHUD()
        taskMgr.add(self.update_game_Hud, "updateHudTask")

        #Fog and changing background
        myFog = Fog("Fog Name")
        f = 0.05
        myFog.setColor(f,f,f)
        myFog.setExpDensity(.01)
        render.setFog(myFog)
        base.setBackgroundColor(f,f,f)

    def updateTimer(self,task):
        if self.TimerGoing == True:
            self.TimeLeft = self.TimeLeft - globalClock.getDt()
            if self.TimeLeft <= 0:
                print"-----------TIME UP!!!!!!!!!---------"
                print self.currentActionCommand.getCommand()
                if self.currentActionCommand.isEmpty() == False:
                    self.playerStability = self.playerStability - 10
                    if self.playerStability <= 0:
                        if self.GameOver == False:
                            #REPLACE TITLE.PNG WITH THE GAME OVER IMAGE!!!!!!
                            self.gameOverScreen = OnscreenImage(image = '../images/GameOver.png', scale = (1.3333333,1,1))
                            self.gameOverScreen.setTransparency(TransparencyAttrib.MAlpha)
                            self.GameOver = True
                            self.Hud.hide = True
                print "***Blanked Action Command***"
                self.currentActionCommand = ActionCommand(0,"")
                self.TimeLeft = self.DefaultTime
                self.TimerGoing = False
        return Task.cont  
    
    def setKey(self, key, value):
        self.keyMap[key] = value
        
    def loadModels(self):
        """loads initial models into the world"""
        #load pipes
        self.numPipes = 6 #number appearing on the stage at any given time
        self.numGenericTypes = 5 #number of normal pipe models
        self.numSpecialTypes = 4 #number of 'broken' pipe models
        self.pipeGenericBag = GrabBag(self.numGenericTypes)
        self.pipeSpecialBag = GrabBag(self.numSpecialTypes)
        self.pipeList = []
        self.pipeInterval = 20.25*3.05#*.98 #length*timesLonger*overlapConstant
        self.pipeDepth = 0
        self.pipeCycle = 1
        
        #create initial pipes
        for i in range(self.numPipes):
            self.createPipe2(i)
            #print self.pipeList[i].model.getY()
        
        #Enable initial shaders
        self.pipeList[0].addShader()
        self.pipeList[1].addShader()
        
        #load spider
        #self.spider = loader.loadModel("../models/spider.egg")
        self.spider = Actor("../models/spider.egg", 
            {"aniFall":"../models/animation_fall cycle.egg",
            "aniFix1":"../models/animation_fixattack1.egg",}
        )
        #setup animation
        self.spider.enableBlend()
        self.spider.setControlEffect('aniFall', 1)        
        self.spider.loop("aniFall")   

        self.spider.reparentTo(render)
        self.spider.setShaderAuto()
        self.spider.setScale(.045)
        self.spider.setZ(4.25)
        self.spider.setH(180)
        self.spider.setP(-65)

        #load back panal
        self.backPanal = loader.loadModel("../models/infinity.egg")
        self.backPanal.reparentTo(render)
        self.backPanal.setZ(4.25)
        self.backPanal.setY(self.pipeInterval*5*.90)
        
            
    def loadSound(self):
        self.openingMusic = loader.loadSfx("../audio/opening.wav")
        self.mainLoopMusic = loader.loadSfx("../audio/mainLoop.wav")
        SoundInterval(self.openingMusic).start()
        
        #repair sound effects
        self.fixSound1 = loader.loadSfx("../audio/repair1.wav")
        self.fixSound2 = loader.loadSfx("../audio/repair2.wav")
        self.fixSound3 = loader.loadSfx("../audio/repair3.wav")
        self.fixSound4 = loader.loadSfx("../audio/repair4.wav")
        self.explosionSound = loader.loadSfx("../audio/explosion.wav")
        
            
    def setupLights(self):
        """loads initial lighting"""
        self.ambientLight = AmbientLight("ambientLight")
        #for setting colors, alpha is largely irrelevant
        self.ambientLight.setColor((.25, .25, .35, 1.0))
        #self.ambientLight.setColor((.25, .25, .25, 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)
        
        self.dirLight = DirectionalLight("dirLight")
        self.dirLight.setColor((.7, .5, .5, 1))
        #self.dirLight.setColor((.7, .7, 1, 1))
        self.dirLightNP = render.attachNewNode(self.dirLight)
        self.dirLightNP.setHpr(0, -25, 0)
        render.setLight(self.dirLightNP)
        
    def setupCollisions(self):
        #make a collision traverser, set it to default
        base.cTrav = CollisionTraverser()
        self.cHandler = CollisionHandlerEvent()
        #set the pattern for the event sent on collision
        # "%in" is substituted with the name of the into object
        self.cHandler.setInPattern("%fn-and-%in")
        
        cSphere = CollisionSphere((0,-5,0), 30)
        cNode = CollisionNode("spider")
        cNode.addSolid(cSphere)
        #spider is *only* a from object
        cNode.setIntoCollideMask(BitMask32.allOff())
        self.spiderCollisionNode = self.spider.attachNewNode(cNode)
        
        #self.spiderCollisionNode.show()
        base.cTrav.addCollider(self.spiderCollisionNode, self.cHandler)
        
        
    def pipeCollide(self, cEntry):
        self.numCollisions += 1
        print self.numCollisions
        #print cEntry.getIntoNodePath().getParent().getParent().getName()
        #print "\n\n\n"
        modelKey = cEntry.getIntoNodePath().getParent().getParent().getKey()
        self.currentPipe = self.getPipe(modelKey)
        if self.currentPipe.actionCommand.isEmpty() == False:
            print "Pipe Action Command = " + str(self.currentPipe.actionCommand.getCommand())
            self.currentActionCommand = ActionCommand(2,"",self.currentPipe.actionCommand.getCommand())
            print "Player Action Command = " + str(self.currentActionCommand.getCommand())
            self.currentPipe.actionCommand.blankCommand()
            print "Player Action Command = " + str(self.currentActionCommand.getCommand())

            print "------!!!!!!!!!!!!!------"

            if self.TimerGoing == False:
                self.TimeLeft = self.DefaultTime
                self.TimerGoing = True
           
            
    def getPipe(self, model):
        modelPath = model
        print modelPath
        print "CollideKey: " + str(modelPath)
        #KeyTestDebug
        for i in range(self.pipeList.__len__()):
            print "Key "+ str(i) +":" + str(self.pipeList[i].key)
        for i in range(self.pipeList.__len__()):
            print "Testing Key: " + str(self.pipeList[i].key)
            if self.pipeList[i].key == modelPath: return(self.pipeList[i])
        
    def update_game_Hud(self,task):
        self.gameScore = self.gameScore + globalClock.getDt()
        tempScore = int(self.gameScore * 100)
        self.Hud.updateHud(self.playerStability,tempScore,self.currentActionCommand.getOriginal())
        return Task.cont    
Example #7
0
class PipeGeneric:
    """
    Creates self contained pipe objects with methods that create,
    reference, and destroy models, collision tubes, lights,
    particles, and ActionCommand sequences.
    """
    def __init__(self, bag, template=False):

        if template is not False: self.reactivate(template)
        else:
            self.addModel(bag)
            self.addPointLight(self.model)
            self.shaderEnabled = 0
            #self.addCollision()
            #self.addParticle()
            self.addActionCommand("")
            self.type = "generic"

    def addPointLight(self, pipe):
        """create a point light for pipe"""

        #The redpoint light and helper
        #RED
        # r = random.uniform(700, 900) / 1000
        # g = random.uniform(0, 300) / 1000
        # b = g

        #ORANGE
        r = 1
        b = random.randint(0,91)
        g = (b / 2) + 102
        b = b / 255.0
        g = g / 255.0
        self.helper = loader.loadModel("../models/sphere.egg.pz")

        self.helper.setColor( Vec4( r, g, b, 1 ) )
        self.helper.setPos(pipe.getPos())
        #print self.helper.getColor()

        #This is value is irrelevent at the moment unless I move the lights
        self.helper.setScale(.25*1) #must be greater than 0.001


        #optionally set location of light within pipe
        self.helper.setY(self.helper.getY()-50*35 ) #moves to inbetween segments
        self.helper.setZ(self.helper.getZ()-50*6 ) #makes 3 sided lights

        self.light = self.helper.attachNewNode( PointLight( "self.light" ) )
        self.light.node().setAttenuation( Vec3( .1, 0.04, 0.1 )/2.5 )
        self.light.node().setColor( Vec4( r, g, b, 1 ) )
        self.light.node().setSpecularColor( Vec4( 1 ) )
        self.helper.reparentTo( pipe )
        render.setLight( self.light )


    def addModel(self, bag):
        """Adds the model to the pipe object"""

        #pick file
        filename = ["../models/tunnel"]
        filename.append(str(bag.pick()))
        filename.append(".egg")
        self.fileName = ''.join(filename)

        #self.fileName = "../models/tunnelclear.egg"

        #load model
        self.model = loader.loadModel(self.fileName)
        self.model.setScale(.0175)
        #print self.model.ls()

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

        self.nodePath = NodePath(self.model)
        self.model.reparentTo(render)
        self.key = self.model.getKey()

    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 addParticle(self, pipe):
        #Particle Effect: VERY SLOW
        self.particle = ParticleEffect()
        self.particle.loadConfig("../models/steam.ptf")
        self.particle.start(pipe)
        self.particle.setPos(100.00, 0.000, 0)
        self.particle.setScale(100.00, 80.00, 80.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()

        #remove pointLight from segment
        render.clearLight(self.light)
        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()