I’m trying to create a falling snow that moves with the camera using emitters this what i did so for :
override public function begin():void
{
// Create emitter's graphic
var bd:BitmapData = new BitmapData(6, 3, true, 0);
bd.setPixel32(1, 1, 0xFFFFFFFF);
bd.fillRect(new Rectangle(3, 0, 3, 3), 0xFFFFFFFF);
// Create emitter
_emitter = new Emitter(bd, 3, 3);
_emitter.relative = false;
// Set the properties for the snow
_emitter.newType(SNOW, [0]);
_emitter.setMotion(SNOW, 40, 5, .2, 200, 1000, .3, Ease.cubeOut);
addGraphic(_emitter);
super.begin();
}
public function emit(type:String, x:int, y:int, size:uint=0):void
{
_emitter.emit(type, x, y);
}
override public function update():void
{
var interval:int = 40;
for (var o:int = 0; o < FP.width; o += interval)
{
emit(SNOW, o + FP.camera.x, -10);
}
_emitter.y += 150 * FP.elapsed;
super.update();
}
I get multiple particles but they’re not falling the way they supposed to, and is there a way to let them disappear before they arrive to the bottom of the screen !