本帖最后由 Stolf 于 2016-4-6 12:21 编辑
@日月星辰
我自己尝试了一种方法解决了。。
Scene_Map.prototype.processMapTouch = function () { if (TouchInput.isTriggered() || this._touchCount > 0) { if (TouchInput.isPressed()) { if (this._touchCount === 0 || this._touchCount >= 15) { var x = $gameMap.canvasToMapX(TouchInput.x); var y = $gameMap.canvasToMapY(TouchInput.y); var Width = $gameVariables.value(1); var Height = $gameVariables.value(2); var dir = [[0, 1], [1, 0], [-1, 0], [0, -1]]; for (var k = 0; k < 4; k++) { var tX = x + dir[k][0]; var tY = y + dir[k][1]; if (tX >= 0 && tX < Width && tY >= 0 && tY < Height) { $gamePlayer.locate(tX, tY); $gameTemp.setDestination(x, y); break; } } } this._touchCount++; } else { this._touchCount = 0; } } };
Scene_Map.prototype.processMapTouch = function ()
{
if (TouchInput.isTriggered() || this._touchCount > 0)
{
if (TouchInput.isPressed())
{
if (this._touchCount === 0 || this._touchCount >= 15)
{
var x = $gameMap.canvasToMapX(TouchInput.x);
var y = $gameMap.canvasToMapY(TouchInput.y);
var Width = $gameVariables.value(1);
var Height = $gameVariables.value(2);
var dir = [[0, 1], [1, 0], [-1, 0], [0, -1]];
for (var k = 0; k < 4; k++)
{
var tX = x + dir[k][0];
var tY = y + dir[k][1];
if (tX >= 0 && tX < Width && tY >= 0 && tY < Height)
{
$gamePlayer.locate(tX, tY);
$gameTemp.setDestination(x, y);
break;
}
}
}
this._touchCount++;
}
else
{
this._touchCount = 0;
}
}
};
|