In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: ビックバンです

Get Adobe Flash player
by yuitest 16 Aug 2011
/**
 * Copyright yuitest ( http://wonderfl.net/user/yuitest )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/c7O1
 */

// forked from 3f5's ビックバンです
package {
    import flash.text.engine.TextRotation;
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.text.TextField;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    import flash.display.Sprite;
    public class Test extends Sprite {
        private var list:Vector.<Blood>;
        private var dbg:TextField = new TextField;
        private var c:Number = 0;
        public function Test() {
            list = new Vector.<Blood>();
            for (var i:Number = 0; i < 10; i++) {
                list.push(new Blood(stage.stageWidth / 2, stage.stageHeight / 2, 10,0,0));
                addChild(list[list.length - 1]);
            }
            addChild(dbg);
            addEventListener(Event.ENTER_FRAME, update);
        }
        public function update(e:Event):void {
            var blood:Blood;
            for each (blood in list) {
                blood.update();
            }            
        }
    }
}
import flash.events.Event;
import flash.utils.Endian;
import flash.display.Sprite;

class Blood extends Sprite
{
    public var aY:Number;
    public var aX:Number;
    public var size:Number;
    public var ended:Boolean;
    public var cont:Boolean;
    private var list:Vector.<Blood>;
    public function Blood(_x:Number, _y:Number, _size:Number,ax:Number,ay:Number) {
        x = _x;
        y = _y;
        ended = false;
        size = _size;
        cont = true;
        graphics.beginFill(0xFF0000);
        graphics.drawCircle(0, 0, _size);
        var radian:Number = Math.random() * Math.PI * 2;
        var radius:Number = Math.random() * 0.7;
        aX = ax + radius * Math.cos(radian);
        aY = ay + radius * Math.sin(radian);
    }
    private function rand(min:Number, max:Number):Number {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    }
    public function makeChild (num:Number):void {
        list = new Vector.<Blood>();
        var reduce:Number = 3;
        var amount:Number = (((size * size) / ((size - reduce) * (size - reduce))) | 0) + 1;
        for (var i:Number = 0; i < amount; i++) {
            list.push(new Blood(0, 0, num - reduce, aX, aY));
            addChild(list[list.length - 1]);
        }
    }
    public function update():void {
        if (rand(1,size) === 1 && !ended && size > 1) {
            ended = true;
            if (rand(1,10) > 1) {
                cont = false;
                graphics.clear();
                makeChild(size);
            }
        }
        if (ended && size > 0 && !cont) {
            var blood:Blood;
            for each (blood in list) {
                blood.update();
            }
        } else {
            aX *= 0.99;
            aY = aY * 0.99 + 0.01;
            x += aX;
            y += aY;
        }
    }
}