Welcome, Guest
Want to take part in these discussions? Sign in if you have an account, or apply for one below
-
- CommentAuthorlostatoll
- CommentTimeFeb 3rd 2011
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 center section, smoothly, as in curve around it. I think I'm missing something big because I can't even find a method of having the particles all be different sizes like between 10-20 pixels.
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! -
- CommentAuthorlostatoll
- CommentTimeFeb 3rd 2011
Am I supposed to created a new emitter just to change the size of the particles? -
- CommentAuthorlostatoll
- CommentTimeFeb 7th 2011
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 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 );
}
}
}
} -
- CommentAuthorlostatoll
- CommentTimeFeb 7th 2011
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 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();
} -
- CommentAuthorlostatoll
- CommentTimeFeb 7th 2011
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 happen. -
- CommentAuthorRichard
- CommentTimeFeb 14th 2011
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.
1 to 6 of 6
