Closed khacduyst closed 8 years ago
Hi khacduyst,
rofl, sorry for the late reply. I guess you solved your issue ... Anyway, for usecases like this each particle has a an extra object in the property customValues, where you can store all you need for stearing behaviours or anything else. The partecleSystem instance has a property called customFunction. Throw your function in there to do your calculations. It will be called once per frame, right before the particles get sorted and their vertices will be updated. So you have to iterate over the particles within the function yourself like this.
function yourCustomFunction (particles, numParticles):void {
var bird:Paricle;
for (var i:int = 0; i < numParticles; ++i) {
bird = particles[i];
if (!bird.customValues) {
bird.customValues = {a:0, b:0, c:0};
}
// your code
// ...
// Clear the values for particles that are done; You can alsoe do this once before you dispose the system. Anyway, remember we're using a particle pool.
if (bird.currentTime >= bird.totalTime && bird.customValues) {
bird.customValues = null;
}
}
}
ffpsInstance.customeFunction = yourCustomFunction;
Again, I'm sorry.
Cheers
Michael
Hi shin10, I'm trying to add boilds movement for the particles, just like this: http://blog.soulwire.co.uk/laboratory/flash/as3-flocking-steering-behaviors
two main feature are:
Can you suggest some ways to apply this?