六角网格邻居(等距路径)

时间:2018-08-28 01:40:34

标签: javascript nearest-neighbor hexagonal-tiles

因此请简要介绍一下:我正在为一款名为iso-path的游戏编写一个Sim,它具有一个六边形网格。

You can check what I've done so far clicking here

任何单元都可以移动到相邻单元。

the hexagonal grid

所以在代码中:

var board = "4567654";

canMove(5, 0); // true
canMove(5, 1); // true
canMove(5, 4); // true
canMove(5, 7); // false

如果一块在行的开头,它可以水平传送到末端,反之亦然。

canMove(22, 27); // true

enter image description here

我可以轻松地对邻居进行硬编码,但是我想按程序进行操作,以便我可以更改电路板配置,并且该功能将以编程方式起作用。

董事会将始终以数字开头,增加至秒,然后再次减少,如下所示:

4567654 (standard)
3456543
1234321
567898765

木板总是六角形的。

0 个答案:

没有答案
相关问题