From 98d6c16ecbb5a37cfbaad147b593365968c0bad6 Mon Sep 17 00:00:00 2001 From: 2685658468 Date: Fri, 14 Sep 2018 20:57:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/map.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/js/map.js b/js/map.js index 565849c..f95bb30 100644 --- a/js/map.js +++ b/js/map.js @@ -225,7 +225,7 @@ function funDrawMap(){ p.beginPath(); p.strokeStyle = "#000"; //棋盘 竖线 - console.log(mapSize.width); + //console.log(mapSize.width); //初始画点(线宽为1 最左边 最上边的线只显示一半)增加w/10 ,h/10 //分割两岸 从 0 画到4, 4~5为楚河汉界,从5 画到9 for(let i = 0; i < 9; i++) { @@ -388,7 +388,6 @@ function funPutChess() { //没有棋子 } } - } drawChess(); } @@ -430,6 +429,8 @@ window.onload = function() { //当前 选中的棋子 let nowSelectedChess = null; + //当前游戏状态 0:和棋,1:红行棋,2:黑行棋,10:红胜,20:黑胜 + let nowGameState = 1 ; map.addEventListener('click', function(e) { let eVent = e || event; //, mapSize.height * (0.12 / 2) //存储空的棋盘位置(索引 i) @@ -467,8 +468,8 @@ window.onload = function() { nowSelectedChess = Root.arrMap[i]; }else{ if(nowSelectedChess.t!=Root.arrMap[i].t){ - //不属于己方阵营 就不覆盖上次选中的棋子 - alert('不属于己方') + //不属于己方阵营 就不覆盖上次选中的棋子,直接吃掉 + alert('不属于己方'+Root.arrMap[i].t) }else{ //同阵营棋子,继续覆盖选中 nowSelectedChess = Root.arrMap[i]; @@ -515,7 +516,6 @@ window.onload = function() { let count = 10; let nowCount = 1; function moveAnimation(){ - //清空选中 if(nowCount>count){ nowSelectedChess = null; @@ -526,14 +526,11 @@ window.onload = function() { Root.arrMap[target.index] = nowSelectedChess; Root.funReDraw(); requestAnimationFrame(moveAnimation); - nowCount++; } } moveAnimation(); console.log('移动到'+JSON.stringify(target)); - - //Root.funReDraw(); //console.log(Root.arrMap); break;