当前位置: 首页 > 图文教程 > Flash动画 > Flash动画制作 > Flash MX 编程深层次应用-网络连线游戏(8)

Flash动画制作
Flash 实现的透视效果(1)
快闪手册—Shift键的妙用(4)
快闪手册:Ctrl键的妙用
Flash雪景贺卡制作(2)
快闪手册:Alt键的妙用(3)
变幻莫测的Flash线条动画(1)
变幻莫测的Flash线条动画(2)
快闪手册:Shift键的妙用(2)
快闪手册—Shift键的妙用(5)
Flash游戏制作规划与流程漫谈(2)
Flash游戏制作:贪食蛇(1)
Flash制作空战游戏(2)
Flash游戏制作常用代码解析(7)
Flash螺旋特效实例剖(1)
Flash游戏制作:贪食蛇(3)
Flash游戏制作:弹力球(3)
Flash螺旋特效实例剖(2)
Flash视觉特效:科技之光(1)
Flash洋葱皮特效模拟(2)
Flash动画:新年演唱会(2)

Flash动画制作 中的 Flash MX 编程深层次应用-网络连线游戏(8)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-22   浏览: 112 ::
收藏到网摘: n/a

7.5 实时下棋(2)

    

4.检查哪方胜利的程序

检查哪方胜利的程序如下:

function check_win(row, col, val) {

    var i = col, count = 0;

    // 先检查行连成四子

    while (_root.chess[row][i] == val and i>=0) {

             count++;

             i--;

    }

    if (count>=4) {

             return true;

    }

    i = col+1;

    while (_root.chess[row][i] == val and i<=6) {

             count++;

             i++;

    }

    if (count>=4) {

             return true;

      

    }

    // 再检查列连成四子

    count = 0;

    i = row;

    while (_root.chess[i][col] == val and i<=5) {

             count++;

             i++;

    }

    if (count>=4) {

             return true;

    }

    // 检查左高斜线

    count = 0;

    i = row;

    j = col;

    while (_root.chess[i][j] == val and i>=0 and j>=0) {

       &n