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