Flint Particle System Forum - Trying to figure out how to slightly randomize particles Sun, 11 Dec 2011 02:48:15 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher Trying to figure out how to slightly randomize particles http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1533#Comment_1533 http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1533#Comment_1533 Thu, 03 Feb 2011 01:56:24 +0000 lostatoll
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 http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1542#Comment_1542 Thu, 03 Feb 2011 21:55:16 +0000 lostatoll Trying to figure out how to slightly randomize particles http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1543#Comment_1543 http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1543#Comment_1543 Mon, 07 Feb 2011 17:16:38 +0000 lostatoll

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 http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1544#Comment_1544 Mon, 07 Feb 2011 17:20:07 +0000 lostatoll


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 http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1545#Comment_1545 Mon, 07 Feb 2011 17:21:43 +0000 lostatoll Trying to figure out how to slightly randomize particles http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1550#Comment_1550 http://flintparticles.org/forum/comments.php?DiscussionID=453&Focus=1550#Comment_1550 Mon, 14 Feb 2011 10:38:20 +0000 Richard
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. ]]>