[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] particles



your performance seems a bit lower than i'd expect, i've got to get my pyopengl going and play with it myself. in the meantime, the bottleneck really looks like it's the "dead" handling section. hmmm..

pos = self.points.coord.point
clr = self.points.color.color

#random value for all particles, be sure to import RandomArray
rnd = RandomArray.random(pos.shape)

#set "dead" to be around 1/4 of all points below floor
dead = pos[:,1] <= 0.0 and rnd[:,0] <= 0.25

#move dead to emitter point and reset color
self.points.coord.point = where(dead, emitter, pos)
self.points.color.color = where(dead, initialColor, clr)

#set random velocities
newvel = rnd + (-.5, .1, -.5) * (2, 20, 2)
self.velocities = where(dead, newvel, self.velocities)


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org