我有一个for loop
并且我正在寻找路径。有用!但是,当我单击地图时,它的速度很快。我如何减慢for loop
喜欢说......每个循环之间的一秒钟内发生的事情?
for (i = 0; i < result.length; ++i) {
var getCoords = new String(result[i]);
var finalCoords = getCoords.split(",");
var finalX = finalCoords[0];
var finalY = finalCoords[1];
currX = parseInt(x_block);
currY = parseInt(y_block);
moving = true;
realSpawnX = finalX * 32;
realSpawnY = finalY * 32;
context.drawImage(playerImg, realSpawnX, realSpawnY, 32, 32);
}