core: add arrow block
This commit is contained in:
parent
e4052913d4
commit
050138f486
@ -33,4 +33,4 @@ HTML5 canvas制作的魔塔样板,支持全平台游戏!
|
||||
|
||||
HTML5魔塔交流群群号: `539113091`
|
||||
|
||||
如有其它意见或建议,也可以通过发issues、或邮件至[ckcz123.com](mailto:ckcz123.com)联系我。
|
||||
如有其它意见或建议,也可以通过发[issues](https://github.com/ckcz123/mota-js/issues)、或邮件至[ckcz123.com](mailto:ckcz123.com)联系我。
|
||||
|
||||
17
libs/core.js
17
libs/core.js
@ -878,10 +878,25 @@ core.prototype.automaticRoute = function (destX, destY) {
|
||||
var nowX = parseInt(f / 13), nowY = f % 13;
|
||||
|
||||
for (var direction in scan) {
|
||||
|
||||
var nowArrow, nowId, nowBlock = core.getBlock(nowX,nowX);
|
||||
if (nowBlock!=null){
|
||||
nowId = nowBlock.block.event.id;
|
||||
nowArrow = nowId.slice(5).toLowerCase();
|
||||
if (direction != nowArrow) continue;
|
||||
}
|
||||
|
||||
var nx = nowX + scan[direction].x;
|
||||
var ny = nowY + scan[direction].y;
|
||||
|
||||
if (nx<0 || nx>12 || ny<0 || ny>12) continue;
|
||||
|
||||
var nextId, nextArrow, nextBlock = core.getBlock(nx,ny);
|
||||
if (nextBlock!=null){
|
||||
nextId = nextBlock.block.event.id;
|
||||
nextArrow = nextId.slice(5).toLowerCase();
|
||||
if ( (scan[direction].x + scan[nextArrow].x) == 0 && (scan[direction].y + scan[nextArrow].y) == 0 ) continue;
|
||||
}
|
||||
|
||||
var nid = 13 * nx + ny;
|
||||
|
||||
if (core.isset(route[nid])) continue;
|
||||
|
||||
@ -78,7 +78,11 @@ maps.prototype.getBlock = function (x, y, id) {
|
||||
if (id == 12) tmp.event = {'cls': 'animates', 'id': 'poisonNet', 'noPass': false, 'trigger': 'passNet'}; // 毒网
|
||||
if (id == 13) tmp.event = {'cls': 'animates', 'id': 'weakNet', 'noPass': false, 'trigger': 'passNet'}; // 衰网
|
||||
if (id == 14) tmp.event = {'cls': 'animates', 'id': 'curseNet', 'noPass': false, 'trigger': 'passNet'}; // 咒网
|
||||
|
||||
// 单向箭头
|
||||
if (id == 15) tmp.event = {'cls': 'terrains', 'id': 'arrowUp','noPass': false}; // 上行箭头
|
||||
if (id == 16) tmp.event = {'cls': 'terrains', 'id': 'arrowLeft','noPass': false}; // 左行箭头
|
||||
if (id == 17) tmp.event = {'cls': 'terrains', 'id': 'arrowDown','noPass': false}; // 下行箭头
|
||||
if (id == 18) tmp.event = {'cls': 'terrains', 'id': 'arrowRight','noPass': false}; // 右行箭头
|
||||
// 21-80 物品
|
||||
if (id == 21) tmp.event = {'cls': 'items', 'id': 'yellowKey'}; // 黄钥匙
|
||||
if (id == 22) tmp.event = {'cls': 'items', 'id': 'blueKey'}; // 蓝钥匙
|
||||
|
||||
Loading…
Reference in New Issue
Block a user