所以我收到了这个错误
Exception in thread "LWJGL Application" java.lang.ArrayIndexOutOfBoundsException: 0
at com.xidstudios.pixelarena.pathfinding.AStarPathfinding.findPath(AStarPathfinding.java:81)
在该行有以下代码,更具体地说,第81行是以下代码的第二行。 (我的格式化程序设置为在代码打开之后将代码放在一个单独的行上。)
openList = new PriorityQueue<TileInfo>(superList.length
* superList[0].length, new ComparatorByScore());
我所拥有的唯一数组是我已初始化的超级列表:
superList = new TileInfo[col][row];
col为列数,row为行数(这是用于寻路)。
为什么我收到此错误以及如何解决此问题?