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

rapid projectiles

hmm, this may come in handy ^.^
Get Adobe Flash player
by hemingway 30 Oct 2012
/**
 * Copyright hemingway ( http://wonderfl.net/user/hemingway )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/v6p5
 */

// forked from hemingway's test env -- inadvertant algorithm for rapidly generated projectile movement tethered to Mouse's cooridnates
package{
    import com   . bit101  . components.*;
    import flash . net     . *;
    import flash . text    . *; 
    import flash . geom    . *;
    import flash . system  . *;
    import flash . events  . *;  
    import flash . display . *;
    import flash . filters . *;

    public class MAIN extends Sprite
    {
        private var _traceLbl : Label;
       
        public var _sprBnds : Sprite = new Sprite;
        public var _sprArr  : Array  = new Array();
        public var _indArr  : int    = 0;
        public var _sprDis  : int;
        public var _sprDx   : int;
        public var _sprDy   : int;
                for (var i:int = 0; i < 50; i++)
                {
                    for (var j:int = 0; j < 50; j++)
                    {
                        _sprArr[_indArr] = new Sprite;
                        _sprArr[_indArr].graphics.beginFill (0x000000);
                        _sprArr[_indArr].graphics.drawCircle(i*10, j*10, 2);
                        _sprArr[_indArr].graphics.endFill   ();
                        
                        addChild(_sprArr[_indArr]);
                        
                        _indArr++;
                    }
                }
                
                addChild(_sprBnds);
                
                addEventListener(Event.ENTER_FRAME, EVNT_Action);
                addEventListener(MouseEvent.MOUSE_MOVE, EVNT_Action);
                
                break;
            }
        }

        internal function EVNT_Action (_E:MouseEvent):void
        {
            switch (_E.type)
            {
                case MouseEvent.MOUSE_MOVE:
                
                _sprBnds.x = (mouseX - 00 - 00);
                _sprBnds.y = (mouseY - 00 - 00);

                break;
                case Event.ENTER_FRAME:
                _indArr = 0;
                
                for (var i:int = 0; i < 50; i++)
                {
                    for (var j:int = 0; j < 50; j++)
                    {
                        _sprDx = (mouseX - i*10);
                        _sprDy = (mouseY - j*10);

                        _sprDis = Math.sqrt(_sprDx*_sprDx - _sprDy*_sprDy);
                        
                        if (_sprDis < 40)
                        {
                            _sprArr[_indArr].width += (_sprDis/20);
                            _sprArr[_indArr].height += (_sprDis/20);
                        }else{
                            _sprArr[_indArr].width = 1;
                            _sprArr[_indArr].height = 1;
                            _sprArr[_indArr].alpha = 1;
                        }
                        
                        _indArr++;
                    }
                }
                break;
            }
        }
}