Flint Particle System Forum - Trying to figure out how to slightly randomize particles 2011-12-11T02:38:23+00:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher Trying to figure out how to slightly randomize particles http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1533#Comment_1533 2011-02-03T01:56:24+00:00 2011-12-11T02:38:23+00:00 lostatoll http://flintparticles.org/forum/account.php?u=466 For example, I'm using the bitmaplinerenderer to draw curved lines and they look really good. and I'm trying to get them to go to general areas of the stage, and more importantly, avoid a large ...
I've tried placing gravity and antigravity wells in the places I don't want them to go but it's not accurate enough. I've tried putting jets to turn them, but again, it's taking a lot of jets. So I'm looking into tweentopoints now, but how could I order the points they tween to as well as instead of a certain point, a general area?

Thanks, love the system so far!]]>
Trying to figure out how to slightly randomize particles http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1542#Comment_1542 2011-02-03T21:55:16+00:00 2011-12-11T02:38:23+00:00 lostatoll http://flintparticles.org/forum/account.php?u=466 Am I supposed to created a new emitter just to change the size of the particles? Trying to figure out how to slightly randomize particles http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1543#Comment_1543 2011-02-07T17:16:38+00:00 2011-12-11T02:38:23+00:00 lostatoll http://flintparticles.org/forum/account.php?u=466 so, I was able to figure out creating random sized particles.. that was all fine and dandy with the scaleImagesInit. and I've got my lines being drawn properly now too. I've resorted to ...

and I've got my lines being drawn properly now too.

I've resorted to extending multiple classes in order to achieve a pulsing between two values. But I did have to add public vars to the particle itself, which I don't know if it's acceptable or not. I'm sure there's a better way to do it.. but I'm definitely figuring out the system.. here is the "pulse" code that tweens a new "life" var between two values.


had to add pulseAge, pulse and cycleLife to the particle to store some new values. I know.. simple and stupid.. but I needed it.



package org.flintparticles.common.actions {
import org.flintparticles.common.emitters.Emitter;
import org.flintparticles.common.energyEasing.Linear;
import org.flintparticles.common.particles.Particle;


public class Pulse extends ActionBase {

private var _easing:Function;
private var _boo:Boolean = true;

public function Pulse ( easing:Function = null) {

if ( easing == null )
{
_easing = Linear.easeNone;
}
else
{
_easing = easing;
}
}

public function get easing():Function {

return _easing;
}
public function set easing( value:Function ):void {

_easing = value;
}

override public function update( emitter:Emitter, particle:Particle, time:Number ):void{

if(particle.pulseAge > particle.cycleLife) {

_boo = false;

}

if(particle.pulseAge < 0) {

_boo = true;

}

if( particle.pulseAge <= particle.cycleLife && _boo) {

particle.pulseAge += time;
particle.pulse = _easing( particle.pulseAge, particle.cycleLife);

}else{

particle.pulseAge -= time;
particle.pulse = _easing( particle.pulseAge, particle.cycleLife );


}

}
}
}]]>
Trying to figure out how to slightly randomize particles http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1544#Comment_1544 2011-02-07T17:20:07+00:00 2011-12-11T02:38:23+00:00 lostatoll http://flintparticles.org/forum/account.php?u=466 ohh, and also, in order to use that pulse code, to tween their size up and down between two values, but keeping in mind their initial size, I wrote this... package ...


package org.flintparticles.common.actions {
import org.flintparticles.common.emitters.Emitter;
import org.flintparticles.common.particles.Particle;

public class PulseScale extends ActionBase {

private var _diffScale:Number;
private var _endScale:Number;


public function PulseScale( startScale:Number = 1, endScale:Number = 1 ){

_diffScale = startScale - endScale;
_endScale = endScale;
}

public function get startScale():Number
{
return _endScale + _diffScale;
}

public function set startScale( value:Number ):void
{
_diffScale = value - _endScale;
}

public function get endScale():Number
{
return _endScale;
}
public function set endScale( value:Number ):void
{
_diffScale = _endScale + _diffScale - value;
_endScale = value;
}
override public function update( emitter:Emitter, particle:Particle, time:Number ):void
{

particle.scale = -(particle.initialScale)*(_endScale + _diffScale * particle.pulse);
}
}
}


and again, in order to do so, I had to add an initialScale var to the particle, and inside ScaleImagesInit, i set that in the initialize method.

override public function initialize( emitter:Emitter, particle:Particle ):void
{
var _ran:Number = _scales.getRandomValue();

//new
particle.initialScale = _ran;
particle.scale = _ran;

//old
//particle.scale = _scales.getRandomValue();
}]]>
Trying to figure out how to slightly randomize particles http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1545#Comment_1545 2011-02-07T17:21:43+00:00 2011-12-11T02:38:23+00:00 lostatoll http://flintparticles.org/forum/account.php?u=466 Currently I'm working on altering their scales based on a random time scale instead of cycle life.. so that they size up and down at different rates.. again, this all might be dumb but i need it to ... Trying to figure out how to slightly randomize particles http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1550#Comment_1550 2011-02-14T10:38:20+00:00 2011-12-11T02:38:23+00:00 Richard http://flintparticles.org/forum/account.php?u=1 Hi You're making great progress. Nice work with the pulsing. The normal way to add additional properties to the Particle is to add them to its dictionary.
You're making great progress. Nice work with the pulsing. The normal way to add additional properties to the Particle is to add them to its dictionary.]]>