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

flash on 2015-7-4

Get Adobe Flash player
by mutantleg 04 Jul 2015
    Embed
/**
 * Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/4pqw
 */

package {
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            
            stage.addEventListener(Event.ENTER_FRAME, onEnter);
        }//ctor
        
        public var gt:int  =0;
        public function onEnter(e:Event):void        
        {
            var mx:Number; var my:Number;
            mx = stage.mouseX; my = stage.mouseY;
            
            camx = mx-230; camy = my-230;
            
            graphics.clear();
            
            //graphics.lineStyle(2, 0);
            
            //drawWall(64+gt,64, 64+gt, 128);
            
            //drawRect(0,0,512,512);
            
            var i:int; var k:int;
            for (i =0; i<8;i++)
            for (k=0;k<8;k++)
            {
                
                drawRect(k*64+16,i*64+16,32,32);
                
            }//nexti

            for (i =0; i<8;i++)
            for (k=0;k<8;k++)
            {
                var ax:Number; var ay:Number;
                ax =k*64+16;
                ay =i*64+16; 
                graphics.beginFill(0x902020, 1);
                graphics.drawRect(ax-camx,ay-camy,32,32);
                graphics.endFill();
            }//nexti
            
            gt+=1;
        }//onenter
        
        public var camx:Number = 0;
        public var camy:Number = 0;
        
        
        public function drawRect(ax:Number, ay:Number, aw:Number, ah:Number):void
        {

            if (ax-camx > 230)
            { drawWall(ax,ay, ax, ay+ah,0x404040); }
            else
            { drawWall(ax+aw,ay, ax+aw, ay+ah,0x404040); }
          
            if (ay-camy > 230)            
            { drawWall(ax,ay, ax+aw, ay); }
            else
            { drawWall(ax,ay+ah, ax+aw, ay+ah); }
            
            
        }//drawrect
        
        public function getMag(ax:Number, ay:Number):Number
        { return Math.sqrt(ax*ax+ay*ay); }
        
        public function drawWall(ax:Number, ay:Number, bx:Number, by:Number, c:uint=0):void
        {
            var ax2:Number; var ay2:Number;
            var bx2:Number; var by2:Number;

                ax-=camx; ay-=camy;
                bx-=camx; by-=camy;

            ax2 = 230-ax; ay2 = 230-ay;

            ax2 = ax+(ax2 * (8 * 0.02));
            ay2 = ay+(ay2 * (8 * 0.02));                       
       
            bx2 = 230-bx; by2 = 230-by;
            bx2 = bx+(bx2 * (8 * 0.02));
            by2 = by+(by2 * (8 * 0.02));                       
  /*
            graphics.moveTo(ax,ay);
            graphics.lineTo(bx,by);
            
            graphics.moveTo(ax2,ay2);
            graphics.lineTo(bx2,by2);
   */         
            graphics.beginFill(c, 1);
              graphics.moveTo(ax,ay);
              graphics.lineTo(bx,by);
              graphics.lineTo(bx2,by2);
              graphics.lineTo(ax2,ay2);
              graphics.lineTo(ax,ay);              
            graphics.endFill();
            
        }//drawwall
        
    }//classend
}