HTML5+JS 《五子飞》游戏实现(七)游戏试玩

前面第一至第六章我们已经把《五子飞》游戏的基本工作都已经讲得差不多了,这一章主要是把所有的代码分享给大家,然后小伙伴们也可以玩一玩。

至于人机对战的我们放到后面讲进行分析。

 

试玩地址:http://www.lyout.com/projects/fiveflychess/FiveflyChess7.htm

 

现在我们来总结一下该小游戏的一些基本定义:

// 定义游戏对象
function GameChess(){
    // 初始配置
    this.init = function ()//...
    // 画棋盘棋子
    this.paint = function ()//...
    this.repaint = function ()//...
    // 开始玩
    this.play = function ()//...
    // 重玩,重置所有棋子
    this.replay = function ()//...
    // 获取索引号
    this.getIndex = function (pDest, pSrc)//...
    // 是否可移动
    this.canMove = function (pDest, pSrc)//...
    // 是否可“挑一对”
    this.canCarry = function (chess)//...
    // 是否可“夹一个”
    this.canClip = function (chess)//...
    // 移动棋子
    this.moveChess = function (pDest, pSrc)//...
    // 游戏结束
    this.isGameOver = function (player)//...
    // 得到对方是哪个玩家
    this.getAnotherPlayer = function (player)//...
    // 游戏开始(包括加载)
    this.start = function (el)//...
}

 

HTML5+JS 《五子飞》游戏实现(一)规则

HTML5+JS 《五子飞》游戏实现(二)路线分析和资源准备

HTML5+JS 《五子飞》游戏实现(三)页面和棋盘棋子

HTML5+JS 《五子飞》游戏实现(四)夹一个和挑一对

HTML5+JS 《五子飞》游戏实现(五)移动棋子

HTML5+JS 《五子飞》游戏实现(六)鼠标响应与多重选择

posted @ 2015-01-17 11:16  里沃特  阅读(848)  评论(1编辑  收藏  举报