Fork me on GitHub
Not signed in (Sign In)

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

    • CommentAuthorsandersnake
    • CommentTimeFeb 23rd 2008 edited
     
    Tried to simulate a shower.
    That dirty piggy needs to be cleaned.

    Check the result at http://www.actionscripter.nl/flash/regendouche.html

    Source Code:

    import flash.geom.Point;
    import org.flintparticles.actions.*;
    import org.flintparticles.counters.*;
    import org.flintparticles.displayObjects.*;
    import org.flintparticles.emitters.*;
    import org.flintparticles.initializers.*;
    import org.flintparticles.zones.*;

    import com.afcomponents.common.display.*;
    import com.afcomponents.common.graphics.*;

    var emitter:DisplayObjectEmitter = new DisplayObjectEmitter();

    emitter.setCounter( new Steady( 350 ) );
    emitter.addInitializer( new ImageClass( Dot, 1 ) );
    var dz:DiscZone = new DiscZone( new Point( 225, 120 ), 60, 0 );
    emitter.addInitializer( new Position( dz ) );
    emitter.addInitializer( new Velocity( new PointZone( new Point( 0, 200 ) ) ) );
    emitter.addInitializer( new Lifetime( 1.5, 1.5 ) );
    emitter.addAction( new Move() );
    emitter.addAction( new Accelerate(0, 200) );
    emitter.addAction( new RandomDrift( 100, 0 ) );
    emitter.addAction( new Age() );
    emitter.addAction( new Fade() );
    emitter.addAction( new DeathOffStage () );

    addChild( emitter );
    emitter.start();
    emitter.runAhead( 0 );
    • CommentAuthorRichard
    • CommentTimeFeb 23rd 2008 edited
     
    You might like to try a set of fixed points to emit the particles from to simulate the holes in the shower head. Something like this (you could also devise an algorithm to create the points rather than defining them one at a time). I don't have the background image so can't tell if this will look better or not.

    import flash.geom.Point;
    import org.flintparticles.actions.*;
    import org.flintparticles.counters.*;
    import org.flintparticles.displayObjects.*;
    import org.flintparticles.emitters.*;
    import org.flintparticles.initializers.*;
    import org.flintparticles.zones.*;

    var emitter:DisplayObjectEmitter = new DisplayObjectEmitter();

    emitter.setCounter( new Steady( 350 ) );
    emitter.addInitializer( new ImageClass( Dot, 1 ) );
    var mz:MultiZone = new MultiZone();
    mz.addZone( new PointZone( new Point( 208, 100 ) ) );
    mz.addZone( new PointZone( new Point( 228, 100 ) ) );
    mz.addZone( new PointZone( new Point( 248, 100 ) ) );
    mz.addZone( new PointZone( new Point( 176, 110 ) ) );
    mz.addZone( new PointZone( new Point( 196, 110 ) ) );
    mz.addZone( new PointZone( new Point( 216, 110 ) ) );
    mz.addZone( new PointZone( new Point( 236, 110 ) ) );
    mz.addZone( new PointZone( new Point( 256, 110 ) ) );
    mz.addZone( new PointZone( new Point( 276, 110 ) ) );
    mz.addZone( new PointZone( new Point( 165, 120 ) ) );
    mz.addZone( new PointZone( new Point( 185, 120 ) ) );
    mz.addZone( new PointZone( new Point( 205, 120 ) ) );
    mz.addZone( new PointZone( new Point( 225, 120 ) ) );
    mz.addZone( new PointZone( new Point( 245, 120 ) ) );
    mz.addZone( new PointZone( new Point( 265, 120 ) ) );
    mz.addZone( new PointZone( new Point( 285, 120 ) ) );
    mz.addZone( new PointZone( new Point( 174, 130 ) ) );
    mz.addZone( new PointZone( new Point( 194, 130 ) ) );
    mz.addZone( new PointZone( new Point( 214, 130 ) ) );
    mz.addZone( new PointZone( new Point( 234, 130 ) ) );
    mz.addZone( new PointZone( new Point( 254, 130 ) ) );
    mz.addZone( new PointZone( new Point( 274, 130 ) ) );
    mz.addZone( new PointZone( new Point( 202, 140 ) ) );
    mz.addZone( new PointZone( new Point( 222, 140 ) ) );
    mz.addZone( new PointZone( new Point( 242, 140 ) ) );
    emitter.addInitializer( new Position( mz ) );
    emitter.addInitializer( new Velocity( new PointZone( new Point( 0, 200 ) ) ) );
    emitter.addInitializer( new Lifetime( 1.5, 1.5 ) );
    emitter.addAction( new Move() );
    emitter.addAction( new Accelerate(0, 200) );
    emitter.addAction( new Age() );
    emitter.addAction( new Fade() );

    addChild( emitter );
    emitter.start();
    emitter.runAhead( 0 );
    • CommentAuthorericr
    • CommentTimeMar 25th 2008
     
    Why not use a bitmapZone for the start point? Just locate the image at the right point over the showerhead and there you go!