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

Flash动画制作
Flash的事件机制:从AsBroadcaster到EventDispatcher
Flash脚本的执行顺序
完全掌握AS中点(.)语法的应用
抗日Flash集之:万里长城永不倒
抗日Flash集之:地道战
抗日Flash集之:抗日新闻
抗日Flash集之:三一八惨案
抗日Flash集之:五四运动
抗日Flash集之:抗日一隅
抗日Flash集之:血染的风采
抗日Flash集之:淞沪抗战
抗日Flash集之:终日到底
抗日Flash集之:东京功略战[游戏]
抗日Flash集之:大中华·1937
抗日Flash集之:长征
抗日Flash集之:抗日宣言
抗日Flash集之:血战钓鱼岛
用Flash MX制作MOV短片
用flash打开本地文件夹
Flash打造迷你特色音乐播放器

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


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