目前共有6篇帖子。
【关注】Flash版魔塔工厂制作进度
1樓 巨大八爪鱼 2013-2-16 22:00
今晚开工
2樓 巨大八爪鱼 2013-2-16 22:14
自动元件取值表的83、85已算好
3樓 巨大八爪鱼 2013-2-16 22:16
还要计算:55,59,62,69,75,87,89,95
4樓 巨大八爪鱼 2013-2-16 22:54
case "area_1h":
      copy_autotile(view_id,x,y,autotile_id,0,96,16,32); //左边线,钩向下
      break;
5樓 巨大八爪鱼 2013-2-16 23:10

/* 绘制自动元件
   * view_id : 图层
   * x       : 地图x坐标
   * y       : 地图y坐标
   * value   : 自动元件值
   */
  private function draw_autotile(view_id:int,x:int,y:int,value:int)
  {
   var autotile_id:int=Math.floor(value/48)-1; //判断是哪一个自动元件
   value=value%48+48;
   var list:Array=new Array();
   
   //下面决定哪些值该绘制些什么
   list[48]=["water"];
   list[49]=["water","cornerA"];
   
   list[50]=["water","cornerB"];
   list[51]=["water","cornerA","cornerB"];
   list[52]=["water","cornerD"];
   list[53]=["water","cornerA","cornerD"];
   list[54]=["water","cornerB","cornerD"];
   list[55]=["water","cornerA","cornerB","cornerD"];
   list[56]=["water","cornerC"];
   list[57]=["water","cornerA","cornerC"];
   list[58]=["water","cornerB","cornerC"];
   list[59]=["water","cornerA","cornerB","cornerC"];
   
   list[60]=["water","cornerC","cornerD"];
   list[61]=["water","cornerA","cornerC","cornerD"];
   list[62]=["water","cornerB","cornerC","cornerD"];
   list[63]=["cornerA","cornerB","cornerC","cornerD"];
   list[64]=["area_4"];
   list[65]=["water","line_left","cornerB"];
   list[66]=["water","line_left","cornerD"];
   list[67]=["line_left","cornerB","cornerD"];
   list[68]=["area_8"];
   list[69]=["area_8","cornerD"];
   
   list[70]=["water","cornerC","line_top"];
   list[71]=["water","cornerC","cornerD","line_top"];
   list[72]=["area_6"];
   list[73]=["water","cornerC","line_right"];
   list[74]=["water","cornerA","line_right"];
   list[75]=["cornerA","cornerC","line_right"];
   list[76]=["area_2"];
   list[77]=["water","cornerA","line_bottom"];
   list[78]=["water","cornerB","line_bottom"];
   list[79]=["water","cornerA","cornerB","line_bottom"];
   
   list[80]=["line_left","line_right"];
   list[81]=["line_top","line_bottom"];
   list[82]=["area_7"];
   list[83]=["line_left","line_top","area_7","cornerD"];
   list[84]=["area_9"];
   list[85]=["line_top","line_right","area_9","cornerC"];
   list[86]=["area_3"];
   list[87]=["line_bottom","line_right","area_3","cornerA"];
   list[88]=["area_1"];
   list[89]=["line_bottom","line_left","area_1","cornerB"];
   
   list[90]=["area_7h","area_9h"];
   list[91]=["area_7h2","area_1h2"];
   list[92]=["area_1h","area_3h"];
   list[93]=["area_9h2","area_3h2"];
   list[94]=["hole"];
   
   //下面是一些绘画模板
   if (list[value]!=null)
   {
    for (var i:int=0;i<list[value].length;i++)
    {
     switch (list[value][i])
     {
     case "water":
      copy_autotile(view_id,x,y,autotile_id,32,64); //画水背景(在图中是大东西最中间的图块)
      break;
     case "hole":
      copy_autotile(view_id,x,y,autotile_id); //画水坑(在图中是最上面一排左边的那个)
      break;
     case "grass":
      copy_autotile(view_id,x,y,autotile_id,32,0); //画草地、木板背景(在图中是最上面一排中间的那个)
      break;
     case "area_7":
      copy_autotile(view_id,x,y,autotile_id,0,32); //主区域左上角(根据小键盘的数字分布可确定)
      break;
     case "area_8":
      copy_autotile(view_id,x,y,autotile_id,32,32); //主区域中上角
      break;
     case "area_9":
      copy_autotile(view_id,x,y,autotile_id,64,32); //主区域右上角
      break;
     case "area_4":
      copy_autotile(view_id,x,y,autotile_id,0,64); //主区域左中角
      break;
     case "area_6":
      copy_autotile(view_id,x,y,autotile_id,64,64); //主区域右中角
      break;
     case "area_1":
      copy_autotile(view_id,x,y,autotile_id,0,96); //主区域左下角
      break;
     case "area_2":
      copy_autotile(view_id,x,y,autotile_id,32,96); //主区域中下角
      break;
     case "area_3":
      copy_autotile(view_id,x,y,autotile_id,64,96); //主区域右下角
      break;
     case "cornerA":
      copy_autotile(view_id,x,y,autotile_id,64,0,16,16); //左上角补口
      break;
     case "cornerB":
      copy_autotile(view_id,x,y,autotile_id,80,0,16,16,16); //右上角补口
      break;
     case "cornerC":
      copy_autotile(view_id,x,y,autotile_id,64,16,16,16,0,16); //左下角补口
      break;
     case "cornerD":
      copy_autotile(view_id,x,y,autotile_id,80,16,16,16,16,16); //右下角补口
      break;
     case "line_left":
      copy_autotile(view_id,x,y,autotile_id,0,64,16,32); //左边线
      break;
     case "line_right":
      copy_autotile(view_id,x,y,autotile_id,80,64,16,32,16); //右边线
      break;
     case "line_top":
      copy_autotile(view_id,x,y,autotile_id,32,32,32,16); //上边线
      break;
     case "line_bottom":
      copy_autotile(view_id,x,y,autotile_id,32,112,32,16,0,16); //下边线
      break;
     
     
     /*
     关于nHn的规定:
     在小键盘上,“7键”位于[左上]角,因此规定7h为[左]边线,钩向[上]
      同理,“3键”位于[右下]角,所以规定3h为[右]边线,钩向[下]
     但如果想表示[上]边线,钩向[左]([左]边线,钩向[上]反过来),只需要在h后面补上2:7h2
     
     copy_autotile函数autotile_id后面的参数:
     (自动元件图中开始坐标x,y),(宽度,高度),(屏幕上相对于要绘制的单元格的左上角的 开始绘制点坐标x,y)
     */
     case "area_7h":
      copy_autotile(view_id,x,y,autotile_id,0,32,16,32); //左边线,钩向上
      break;
     case "area_7h2":
      copy_autotile(view_id,x,y,autotile_id,0,32,32,16); //上边线,钩向左
      break;
     case "area_9h":
      copy_autotile(view_id,x,y,autotile_id,80,32,16,32,16); //右边线,钩向上
      break;
     case "area_9h2":
      copy_autotile(view_id,x,y,autotile_id,64,32,32,16); //上边线,钩向右
      break;
     case "area_1h":
      copy_autotile(view_id,x,y,autotile_id,0,96,16,32); //左边线,钩向下
      break;
     case "area_1h2":
      copy_autotile(view_id,x,y,autotile_id,0,112,32,16,0,16); //下边线,钩向左
      break;
     case "area_3h":
      copy_autotile(view_id,x,y,autotile_id,80,96,16,32,16,0); //右边线,钩向下
      break;
     case "area_3h2":
      copy_autotile(view_id,x,y,autotile_id,64,112,32,16,0,16); //下边线,钩向右
      break;
     }
    }
   }
   else
    trace("无法识别的图块“自动元件:"+value+"”");

 

 

除了95,其余全部计算好了

6樓 巨大八爪鱼 2013-2-17 08:46
地图动画已经能动了,速度设的是300ms

回復帖子

內容:
用戶名: 您目前是匿名發表
驗證碼:
 
 
©2010-2024 Arslanbar [手機版] [桌面版]
除非另有聲明,本站採用創用CC姓名標示-相同方式分享 3.0 Unported許可協議進行許可。