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

Flash动画制作
Flash MX Pro 2004新模板应用(6)
Flash MX Pro 2004新模板应用(7)
Flash变速滑动菜单剖析(2)
Flash 交互打字效果(2)
Flash模拟老电影播放效果(2)
快闪手册:Shift键的妙用(3)
用Flash制作密码保护页面(2)
快闪手册:双击如飞(3)
Flash动画制作技巧(1)
Flash动画制作技巧(2)
Flash动画制作技巧(3)
Flash实例:变色城堡
快闪手册—Shift键的妙用(6)
Flash雪景贺卡制作(4)
Flash实例:小桥流水(3)
变幻莫测的Flash线条动画(3)
Flash放大镜效果深入改进(2)
Flash影片的倒转播放控制(2)
轻松实现Flash动态背景(1)
轻松实现Flash动态背景(2)

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-22   浏览: 103 ::
收藏到网摘: 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