设置图块和角色移动速度
This commit is contained in:
parent
ceffe0d3b5
commit
ddaa596377
@ -2290,6 +2290,7 @@ tooltip : 移动方向
|
|||||||
helpUrl : /_docs/#/instruction
|
helpUrl : /_docs/#/instruction
|
||||||
default : ["up", 0]
|
default : ["up", 0]
|
||||||
colour : this.subColor
|
colour : this.subColor
|
||||||
|
if (Move_List_0 == 'speed' && Int_0 < 16) throw '设置的移动速度值不得小于16';
|
||||||
return ', "' + Move_List_0 + ':' + Int_0 + '"';
|
return ', "' + Move_List_0 + ':' + Int_0 + '"';
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
@ -3915,8 +3916,8 @@ Key_List
|
|||||||
/*Key_List ['yellowKey','blueKey','redKey','greenKey','steelKey']*/;
|
/*Key_List ['yellowKey','blueKey','redKey','greenKey','steelKey']*/;
|
||||||
|
|
||||||
Move_List
|
Move_List
|
||||||
: '上'|'下'|'左'|'右'|'前'|'后'|'左上'|'左下'|'右上'|'右下'
|
: '上'|'下'|'左'|'右'|'前'|'后'|'左上'|'左下'|'右上'|'右下'|'设置速度'
|
||||||
/*Move_List ['up','down','left','right','forward','backward','leftup','leftdown','rightup','rightdown']*/;
|
/*Move_List ['up','down','left','right','forward','backward','leftup','leftdown','rightup','rightdown','speed']*/;
|
||||||
|
|
||||||
NameMap_List
|
NameMap_List
|
||||||
: '确定'|'取消'|'操作失败'|'光标移动'|'打开界面'|'读档'|'存档'|'获得道具'|'回血'|'炸弹'|'飞行器'|'开关门'|'上下楼'|'跳跃'|'破墙镐'|'阻激夹域'|'穿脱装备'
|
: '确定'|'取消'|'操作失败'|'光标移动'|'打开界面'|'读档'|'存档'|'获得道具'|'回血'|'炸弹'|'飞行器'|'开关门'|'上下楼'|'跳跃'|'破墙镐'|'阻激夹域'|'穿脱装备'
|
||||||
|
|||||||
@ -3150,24 +3150,35 @@ events.prototype.eventMoveHero = function(steps, time, callback) {
|
|||||||
var step = 0, moveSteps = (steps||[]).map(function (t) {
|
var step = 0, moveSteps = (steps||[]).map(function (t) {
|
||||||
return [t.split(':')[0], parseInt(t.split(':')[1]||"1")];
|
return [t.split(':')[0], parseInt(t.split(':')[1]||"1")];
|
||||||
}).filter(function (t) {
|
}).filter(function (t) {
|
||||||
return ['up','down','left','right','forward','backward','leftup','leftdown','rightup','rightdown'].indexOf(t[0])>=0;
|
return ['up','down','left','right','forward','backward','leftup','leftdown','rightup','rightdown','speed'].indexOf(t[0])>=0
|
||||||
|
&& !(t[0] == 'speed' && t[1] < 16);
|
||||||
});
|
});
|
||||||
core.status.heroMoving = -1;
|
core.status.heroMoving = -1;
|
||||||
var animate=window.setInterval(function() {
|
var _run = function () {
|
||||||
if (moveSteps.length==0) {
|
var animate=window.setInterval(function() {
|
||||||
delete core.animateFrame.asyncId[animate];
|
if (moveSteps.length==0) {
|
||||||
clearInterval(animate);
|
delete core.animateFrame.asyncId[animate];
|
||||||
core.status.heroMoving = 0;
|
clearInterval(animate);
|
||||||
core.drawHero();
|
core.status.heroMoving = 0;
|
||||||
if (callback) callback();
|
core.drawHero();
|
||||||
}
|
if (callback) callback();
|
||||||
else {
|
}
|
||||||
if (core.events._eventMoveHero_moving(++step, moveSteps))
|
else {
|
||||||
step = 0;
|
if (step == 0 && moveSteps[0][0] == 'speed' && moveSteps[0][1] >= 16) {
|
||||||
}
|
time = moveSteps[0][1];
|
||||||
}, core.status.replay.speed == 24 ? 1 : time / 8 / core.status.replay.speed);
|
moveSteps.shift();
|
||||||
|
clearInterval(animate);
|
||||||
core.animateFrame.asyncId[animate] = true;
|
delete core.animateFrame.asyncId[animate];
|
||||||
|
_run();
|
||||||
|
}
|
||||||
|
else if (core.events._eventMoveHero_moving(++step, moveSteps))
|
||||||
|
step = 0;
|
||||||
|
}
|
||||||
|
}, core.status.replay.speed == 24 ? 1 : time / 8 / core.status.replay.speed);
|
||||||
|
|
||||||
|
core.animateFrame.asyncId[animate] = true;
|
||||||
|
}
|
||||||
|
_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
events.prototype._eventMoveHero_moving = function (step, moveSteps) {
|
events.prototype._eventMoveHero_moving = function (step, moveSteps) {
|
||||||
|
|||||||
46
libs/maps.js
46
libs/maps.js
@ -2247,7 +2247,8 @@ maps.prototype.moveBlock = function (x, y, steps, time, keep, callback) {
|
|||||||
var moveSteps = (steps||[]).map(function (t) {
|
var moveSteps = (steps||[]).map(function (t) {
|
||||||
return [t.split(':')[0], parseInt(t.split(':')[1]||"1")];
|
return [t.split(':')[0], parseInt(t.split(':')[1]||"1")];
|
||||||
}).filter(function (t) {
|
}).filter(function (t) {
|
||||||
return ['up','down','left','right','forward','backward','leftup','leftdown','rightup','rightdown'].indexOf(t[0])>=0;
|
return ['up','down','left','right','forward','backward','leftup','leftdown','rightup','rightdown','speed'].indexOf(t[0])>=0
|
||||||
|
&& !(t[0] == 'speed' && t[1] < 16)
|
||||||
});
|
});
|
||||||
var canvases = this._initDetachedBlock(blockInfo, x, y, block.event.animate !== false);
|
var canvases = this._initDetachedBlock(blockInfo, x, y, block.event.animate !== false);
|
||||||
this._moveDetachedBlock(blockInfo, 32 * x, 32 * y, 1, canvases);
|
this._moveDetachedBlock(blockInfo, 32 * x, 32 * y, 1, canvases);
|
||||||
@ -2261,21 +2262,38 @@ maps.prototype.moveBlock = function (x, y, steps, time, keep, callback) {
|
|||||||
|
|
||||||
maps.prototype._moveBlock_doMove = function (blockInfo, canvases, moveInfo, callback) {
|
maps.prototype._moveBlock_doMove = function (blockInfo, canvases, moveInfo, callback) {
|
||||||
var animateTotal = core.icons._getAnimateFrames(blockInfo.cls), animateTime = 0;
|
var animateTotal = core.icons._getAnimateFrames(blockInfo.cls), animateTime = 0;
|
||||||
var animate = window.setInterval(function () {
|
var _run = function () {
|
||||||
if (blockInfo.cls != 'tileset') {
|
var animate = window.setInterval(function () {
|
||||||
animateTime += moveInfo.per_time;
|
if (blockInfo.cls != 'tileset') {
|
||||||
if (animateTime > core.values.animateSpeed) {
|
animateTime += moveInfo.per_time;
|
||||||
animateTime = 0;
|
if (animateTime > core.values.animateSpeed) {
|
||||||
blockInfo.posX = (blockInfo.posX + 1) % animateTotal;
|
animateTime = 0;
|
||||||
|
blockInfo.posX = (blockInfo.posX + 1) % animateTotal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (moveInfo.moveSteps.length != 0) {
|
||||||
if (moveInfo.moveSteps.length != 0)
|
if (core.maps._moveBlock_updateSpeed(moveInfo)) {
|
||||||
core.maps._moveBlock_moving(blockInfo, canvases, moveInfo);
|
clearInterval(animate);
|
||||||
else
|
delete core.animateFrame.asyncId[animate];
|
||||||
core.maps._moveJumpBlock_finished(blockInfo, canvases, moveInfo, animate, callback);
|
_run();
|
||||||
}, moveInfo.per_time);
|
}
|
||||||
|
else core.maps._moveBlock_moving(blockInfo, canvases, moveInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
core.maps._moveJumpBlock_finished(blockInfo, canvases, moveInfo, animate, callback);
|
||||||
|
}, moveInfo.per_time);
|
||||||
|
core.animateFrame.asyncId[animate] = true;
|
||||||
|
}
|
||||||
|
_run();
|
||||||
|
}
|
||||||
|
|
||||||
core.animateFrame.asyncId[animate] = true;
|
maps.prototype._moveBlock_updateSpeed = function (moveInfo) {
|
||||||
|
if (moveInfo.step == 0 && moveInfo.moveSteps[0][0] == 'speed' && moveInfo.moveSteps[0][1] >= 16) {
|
||||||
|
moveInfo.per_time = moveInfo.moveSteps[0][1] / 16 / core.status.replay.speed;
|
||||||
|
moveInfo.moveSteps.shift();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
maps.prototype._moveBlock_updateDirection = function (blockInfo, moveInfo) {
|
maps.prototype._moveBlock_updateDirection = function (blockInfo, moveInfo) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user