Esempio n. 1
0
    def register_particle(self, part):
        #This gets called by every particle when it is created
        #here we set up it's attributes to make it "work" correctly
        dx = randfloat(-.08, .08)
        dy = randfloat(.15, .3)
        dz = randfloat(-.08, .08)

        rot = random.randint(-25, 25)

        #beyond the basic pos, rot, colorize attributes that all Images have
        #each particle also has an extra_data dictionary, where you can put things specific
        #to your particles.
        #here we put things like rot and direction into extra_data
        part.extra_data["dir"] = (dx, dy, dz)
        part.extra_data["rot"] = rot

        x, y, z = self.emitter.pos

        part.image.pos = x+dx*randfloat(1, 2), y, z+dz*randfloat(1, 2)
Esempio n. 2
0
    def register_particle(self, part):
        #This is a lot like the Fire3D one, except note there is no rotation...
        dx = randfloat(-.04, .04)
        dy = randfloat(.08, .125)
        dz = randfloat(-.04, .04)

        part.extra_data["dir"] = (dx, dy, dz)
        part.colorize = (randfloat(.75,1), randfloat(0,.75), 0, .5)

        x, y, z = self.emitter.pos

        part.pos = x + dx * randfloat(1, 3), y, z + dz * randfloat(1, 3)

        part.colorize = random.choice(((1, 0, 0, 1),
                                       (1, .25, 0, 1),
                                       (1, 1, 0, 1)))