※現在、「wonderfl build flash online」求人コンテンツ制作に関してのアンケートを実施中です!みなさまのお力添えを頂いて、続々とアンケート結果が集まっていますが、まだまだ募集しております。ご協力のほど、どうぞよろしくお願いいたします!

wonderfl運営事務局
→アンケートページ(※ログインしてからお答えいただけるようになっています。)

 notice: Flash editor updated! Join the development! Thanks to MiniBuilder


forked from : miyaoka's Maze generator(multi-route) [diff(39)]

FAVORITE BY
:
迷路
:
迷路 い、入り口は?? 全部つながってるのからどこでもいいのかna
FORKED
  1. // forked from miyaoka's Maze generator(singular route)
  2. //棒倒し法、カベ重複無し版(単一ルート)
  3. package  
  4. {
  5.     import flash.display.Sprite;
  6.     import flash.events.MouseEvent;
  7.     [SWF(width="465", height="465", backgroundColor= 0x000000, frameRate="60")]
  8.     public class Maze
  9.     extends Sprite
  10.     {        
  11.         public function Maze() :void
  12.         {
  13.             stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  14.             mouseDownHandler(null);
  15.         }
  16.         private function mouseDownHandler(e:MouseEvent):void 
  17.         {
  18.             while (numChildren) removeChildAt(0);
  19.             var num:uint = 10;
  20.             var maze:MazeContainer = new MazeContainer(num, num);
  21.             maze.scaleX = maze.scaleY  = stage.stageWidth / (num * 2 +1);
  22.             maze.width = maze.height -= 30;
  23.             maze.x = (stage.stageWidth - maze.width) / 2
  24.             maze.y = (stage.stageHeight - maze.height) / 2
  25.             addChild(maze);
  26.         }
  27.     }    
  28. }
  29. import flash.display.Sprite
  30. import flash.geom.Matrix;
  31. import flash.display.BitmapData;
  32. import flash.display.Bitmap;
  33. class MazeContainer
  34. extends Bitmap
  35. {
  36.     public function MazeContainer(col:uint = 1, row:uint = 1) :void
  37.     {
  38.         bitmapData = new BitmapData(col * 2 + 1, row * 2 + 1false, 0xFFFFFFFF);
  39.         bitmapData.lock();
  40.         var c:uint;
  41.         var r:uint;
  42.         var block:Block;
  43.         var lastBlockIsBotton:Boolean = false;
  44.         //col:0
  45.         for (r = 0; r < row; r++)
  46.         {
  47.             block = new Block(!lastBlockIsBotton, true);
  48.             bitmapData.draw(block, new Matrix(10011, r * 2 + 1));
  49.             lastBlockIsBotton = block.isBottom;
  50.         }
  51.         for (c = 1; c < col; c++)
  52.         {
  53.             for (r = 0; r < row; r++)
  54.             {
  55.                 if (r == 0) lastBlockIsBotton = false;
  56.                 block = new Block(!lastBlockIsBotton, false);
  57.                 bitmapData.draw(block, new Matrix(1001, c * 2+1, r * 2+1));
  58.                 lastBlockIsBotton = block.isBottom;
  59.             }
  60.         }
  61.         bitmapData.unlock();
  62.     }
  63. }
  64. class Block
  65. extends Sprite
  66. {
  67.     public var isBottom:Boolean;
  68.     public static const XY:Array = [
  69.         [0, -1], //top
  70.         [10], //right
  71.         [01], //bottom
  72.         [-10//left
  73.     ];
  74.     public function Block(hasTop:Boolean = true, hasLeft:Boolean = false) :void
  75.     {
  76.         graphics.beginFill(0x000000);
  77.         graphics.drawRect(0011);
  78.         var rot:uint = Math.floor(Math.random() * (2 + (hasLeft ? 1 : 0) + (hasTop? 1 : 0))) + (hasTop? 0 : 1);
  79.         if (rot == 2) isBottom = true;
  80. //        graphics.beginFill(0x999999);
  81.         graphics.drawRect(XY[rot][0], XY[rot][1], 11);
  82.     }
  83. }
noswf
  1. // forked from miyaoka's Maze generator(singular route)
  2. //棒倒し法、カベ重複無し版(単一ルート)
  3. package  
  4. {
  5.     import flash.display.Sprite;
  6.     import flash.events.MouseEvent;
  7.     [SWF(width="465", height="465", backgroundColor= 0x000000, frameRate="60")]
  8.     public class Maze
  9.     extends Sprite
  10.     {        
  11.         public function Maze() :void
  12.         {
  13.             stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  14.             mouseDownHandler(null);
  15.         }
  16.         private function mouseDownHandler(e:MouseEvent):void 
  17.         {
  18.             while (numChildren) removeChildAt(0);
  19.             var num:uint = Math.floor(Math.random() * 60 + 2);
  20.             var maze:MazeContainer = new MazeContainer(num, num);
  21.             maze.scaleX = maze.scaleY  = stage.stageWidth / (num * 2 +1);
  22.             maze.width = maze.height -= 10;
  23.             maze.x = (stage.stageWidth - maze.width) / 2
  24.             maze.y = (stage.stageHeight - maze.height) / 2
  25.             addChild(maze);
  26.         }
  27.     }    
  28. }
  29. import flash.display.Sprite
  30. import flash.geom.Matrix;
  31. import flash.display.BitmapData;
  32. import flash.display.Bitmap;
  33. class MazeContainer
  34. extends Bitmap
  35. {
  36.     public function MazeContainer(col:uint = 1, row:uint = 1) :void
  37.     {
  38.         bitmapData = new BitmapData(col * 2 + 1, row * 2 + 1false, 0xFFFFFFFF);
  39.         bitmapData.lock();
  40.         var c:uint;
  41.         var r:uint;
  42.         var block:Block;
  43.         var lastBlockIsBotton:Boolean = false;
  44.         //col:0
  45.         for (r = 0; r < row; r++)
  46.         {
  47.             block = new Block(!lastBlockIsBotton, true);
  48.             bitmapData.draw(block, new Matrix(10011, r * 2 + 1));
  49.             lastBlockIsBotton = block.isBottom;
  50.         }
  51.         for (c = 1; c < col; c++)
  52.         {
  53.             for (r = 0; r < row; r++)
  54.             {
  55.                 if (r == 0) lastBlockIsBotton = false;
  56.                 block = new Block(!lastBlockIsBotton, false);
  57.                 bitmapData.draw(block, new Matrix(1001, c * 2+1, r * 2+1));
  58.                 lastBlockIsBotton = block.isBottom;
  59.             }
  60.         }
  61.         bitmapData.unlock();
  62.     }
  63. }
  64. class Block
  65. extends Sprite
  66. {
  67.     public var isBottom:Boolean;
  68.     public static const XY:Array = [
  69.         [0, -1], //top
  70.         [10], //right
  71.         [01], //bottom
  72.         [-10//left
  73.     ];
  74.     public function Block(hasTop:Boolean = true, hasLeft:Boolean = false) :void
  75.     {
  76.         graphics.beginFill(0x000000);
  77.         graphics.drawRect(0011);
  78.         var rot:uint = Math.floor(Math.random() * (2 + (hasLeft ? 1 : 0) + (hasTop? 1 : 0))) + (hasTop? 0 : 1);
  79.         if (rot == 2) isBottom = true;
  80. //        graphics.beginFill(0x999999);
  81.         graphics.drawRect(XY[rot][0], XY[rot][1], 11);
  82.     }
  83. }
noswf
  1. // forked from miyaoka's Maze generator(singular route)
  2. //棒倒し法、カベ重複無し版(単一ルート)
  3. package  
  4. {
  5.     import flash.display.Sprite;
  6.     import flash.events.MouseEvent;
  7.     [SWF(width="465", height="465", backgroundColor= 0x000000, frameRate="60")]
  8.     public class Maze
  9.     extends Sprite
  10.     {        
  11.         public function Maze() :void
  12.         {
  13.             stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  14.             mouseDownHandler(null);
  15.         }
  16.         private function mouseDownHandler(e:MouseEvent):void 
  17.         {
  18.             while (numChildren) removeChildAt(0);
  19.             var num:uint = Math.floor(Math.random() * 60 + 2);
  20.             var maze:MazeContainer = new MazeContainer(num, num);
  21.             maze.scaleX = maze.scaleY  = stage.stageWidth / (num * 2 +1);
  22.             maze.width = maze.height -= 30;
  23.             maze.x = (stage.stageWidth - maze.width) / 2
  24.             maze.y = (stage.stageHeight - maze.height) / 2
  25.             addChild(maze);
  26.         }
  27.     }    
  28. }
  29. import flash.display.Sprite
  30. import flash.geom.Matrix;
  31. import flash.display.BitmapData;
  32. import flash.display.Bitmap;
  33. class MazeContainer
  34. extends Bitmap
  35. {
  36.     public function MazeContainer(col:uint = 1, row:uint = 1) :void
  37.     {
  38.         bitmapData = new BitmapData(col * 2 + 1, row * 2 + 1false, 0xFFFFFFFF);
  39.         bitmapData.lock();
  40.         var c:uint;
  41.         var r:uint;
  42.         var block:Block;
  43.         var lastBlockIsBotton:Boolean = false;
  44.         //col:0
  45.         for (r = 0; r < row; r++)
  46.         {
  47.             block = new Block(!lastBlockIsBotton, true);
  48.             bitmapData.draw(block, new Matrix(10011, r * 2 + 1));
  49.             lastBlockIsBotton = block.isBottom;
  50.         }
  51.         for (c = 1; c < col; c++)
  52.         {
  53.             for (r = 0; r < row; r++)
  54.             {
  55.                 if (r == 0) lastBlockIsBotton = false;
  56.                 block = new Block(!lastBlockIsBotton, false);
  57.                 bitmapData.draw(block, new Matrix(1001, c * 2+1, r * 2+1));
  58.                 lastBlockIsBotton = block.isBottom;
  59.             }
  60.         }
  61.         bitmapData.unlock();
  62.     }
  63. }
  64. class Block
  65. extends Sprite
  66. {
  67.     public var isBottom:Boolean;
  68.     public static const XY:Array = [
  69.         [0, -1], //top
  70.         [10], //right
  71.         [01], //bottom
  72.         [-10//left
  73.     ];
  74.     public function Block(hasTop:Boolean = true, hasLeft:Boolean = false) :void
  75.     {
  76.         graphics.beginFill(0x000000);
  77.         graphics.drawRect(0011);
  78.         var rot:uint = Math.floor(Math.random() * (2 + (hasLeft ? 1 : 0) + (hasTop? 1 : 0))) + (hasTop? 0 : 1);
  79.         if (rot == 2) isBottom = true;
  80. //        graphics.beginFill(0x999999);
  81.         graphics.drawRect(XY[rot][0], XY[rot][1], 11);
  82.     }
  83. }
noswf
Get Adobe Flash Player