Async move & jump
This commit is contained in:
parent
52f311ce58
commit
cbbd973357
@ -1084,45 +1084,48 @@ return code;
|
|||||||
*/;
|
*/;
|
||||||
|
|
||||||
move_s
|
move_s
|
||||||
: '移动事件' 'x' PosString? ',' 'y' PosString? '动画时间' Int? '不消失' Bool BGNL? StepString Newline
|
: '移动事件' 'x' PosString? ',' 'y' PosString? '动画时间' Int? '不消失' Bool '不等待执行完毕' Bool BGNL? StepString Newline
|
||||||
|
|
||||||
|
|
||||||
/* move_s
|
/* move_s
|
||||||
tooltip : move: 让某个NPC/怪物移动,位置可不填代表当前事件
|
tooltip : move: 让某个NPC/怪物移动,位置可不填代表当前事件
|
||||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=move%EF%BC%9A%E8%AE%A9%E6%9F%90%E4%B8%AAnpc%E6%80%AA%E7%89%A9%E7%A7%BB%E5%8A%A8
|
helpUrl : https://h5mota.com/games/template/docs/#/event?id=move%EF%BC%9A%E8%AE%A9%E6%9F%90%E4%B8%AAnpc%E6%80%AA%E7%89%A9%E7%A7%BB%E5%8A%A8
|
||||||
default : ["","",500,false,"上右3下2左上左2"]
|
default : ["","",500,false,false,"上右3下2左上左2"]
|
||||||
colour : this.eventColor
|
colour : this.eventColor
|
||||||
var floorstr = '';
|
var floorstr = '';
|
||||||
if (PosString_0 && PosString_1) {
|
if (PosString_0 && PosString_1) {
|
||||||
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
||||||
}
|
}
|
||||||
Int_0 = Int_0 ?(', "time": '+Int_0):'';
|
Int_0 = Int_0 ?(', "time": '+Int_0):'';
|
||||||
var code = '{"type": "move"'+floorstr+''+Int_0+', "steps": '+JSON.stringify(StepString_0)+', "keep": '+Bool_0+'},\n';
|
Bool_0 = Bool_0?', "keep": true':'';
|
||||||
|
Bool_1 = Bool_1?', "async": true':'';
|
||||||
|
var code = '{"type": "move"'+floorstr+Int_0+Bool_0+Bool_1+', "steps": '+JSON.stringify(StepString_0)+'},\n';
|
||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
moveHero_s
|
moveHero_s
|
||||||
: '移动勇士' '动画时间' Int? BGNL? StepString Newline
|
: '移动勇士' '动画时间' Int? '不等待执行完毕' Bool BGNL? StepString Newline
|
||||||
|
|
||||||
|
|
||||||
/* moveHero_s
|
/* moveHero_s
|
||||||
tooltip : moveHero:移动勇士,用这种方式移动勇士的过程中将无视一切地形, 无视一切事件, 中毒状态也不会扣血
|
tooltip : moveHero:移动勇士,用这种方式移动勇士的过程中将无视一切地形, 无视一切事件, 中毒状态也不会扣血
|
||||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=movehero%EF%BC%9A%E7%A7%BB%E5%8A%A8%E5%8B%87%E5%A3%AB
|
helpUrl : https://h5mota.com/games/template/docs/#/event?id=movehero%EF%BC%9A%E7%A7%BB%E5%8A%A8%E5%8B%87%E5%A3%AB
|
||||||
default : [500,"上右3下2左上左2"]
|
default : [500,false,"上右3下2左上左2"]
|
||||||
colour : this.dataColor
|
colour : this.dataColor
|
||||||
Int_0 = Int_0 ?(', "time": '+Int_0):'';
|
Int_0 = Int_0 ?(', "time": '+Int_0):'';
|
||||||
var code = '{"type": "moveHero"'+Int_0+', "steps": '+JSON.stringify(StepString_0)+'},\n';
|
Bool_0 = Bool_0?', "async": true':'';
|
||||||
|
var code = '{"type": "moveHero"'+Int_0+Bool_0+', "steps": '+JSON.stringify(StepString_0)+'},\n';
|
||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
jump_s
|
jump_s
|
||||||
: '跳跃事件' '起始 x' PosString? ',' 'y' PosString? '终止 x' PosString? ',' 'y' PosString? '动画时间' Int? '不消失' Bool Newline
|
: '跳跃事件' '起始 x' PosString? ',' 'y' PosString? '终止 x' PosString? ',' 'y' PosString? '动画时间' Int? '不消失' Bool '不等待执行完毕' Bool Newline
|
||||||
|
|
||||||
|
|
||||||
/* jump_s
|
/* jump_s
|
||||||
tooltip : jump: 让某个NPC/怪物跳跃
|
tooltip : jump: 让某个NPC/怪物跳跃
|
||||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=jump%EF%BC%9A%E8%AE%A9%E6%9F%90%E4%B8%AANPC%2F%E6%80%AA%E7%89%A9%E8%B7%B3%E8%B7%83
|
helpUrl : https://h5mota.com/games/template/docs/#/event?id=jump%EF%BC%9A%E8%AE%A9%E6%9F%90%E4%B8%AANPC%2F%E6%80%AA%E7%89%A9%E8%B7%B3%E8%B7%83
|
||||||
default : ["","","","",500,true]
|
default : ["","","","",500,true,false]
|
||||||
colour : this.eventColor
|
colour : this.eventColor
|
||||||
var floorstr = '';
|
var floorstr = '';
|
||||||
if (PosString_0 && PosString_1) {
|
if (PosString_0 && PosString_1) {
|
||||||
@ -1132,25 +1135,28 @@ if (PosString_2 && PosString_3) {
|
|||||||
floorstr += ', "to": ['+PosString_2+','+PosString_3+']';
|
floorstr += ', "to": ['+PosString_2+','+PosString_3+']';
|
||||||
}
|
}
|
||||||
Int_0 = Int_0 ?(', "time": '+Int_0):'';
|
Int_0 = Int_0 ?(', "time": '+Int_0):'';
|
||||||
var code = '{"type": "jump"'+floorstr+''+Int_0+', "keep": '+Bool_0+'},\n';
|
Bool_0 = Bool_0?', "keep": true':'';
|
||||||
|
Bool_1 = Bool_1?', "async": true':'';
|
||||||
|
var code = '{"type": "jump"'+floorstr+''+Int_0+Bool_0+Bool_1+'},\n';
|
||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
jumpHero_s
|
jumpHero_s
|
||||||
: '跳跃勇士' 'x' PosString? ',' 'y' PosString? '动画时间' Int? Newline
|
: '跳跃勇士' 'x' PosString? ',' 'y' PosString? '动画时间' Int? '不等待执行完毕' Bool Newline
|
||||||
|
|
||||||
|
|
||||||
/* jumpHero_s
|
/* jumpHero_s
|
||||||
tooltip : jumpHero: 跳跃勇士
|
tooltip : jumpHero: 跳跃勇士
|
||||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=jumpHero%EF%BC%9A%E8%B7%B3%E8%B7%83%E5%8B%87%E5%A3%AB
|
helpUrl : https://h5mota.com/games/template/docs/#/event?id=jumpHero%EF%BC%9A%E8%B7%B3%E8%B7%83%E5%8B%87%E5%A3%AB
|
||||||
default : ["","",500]
|
default : ["","",500,false]
|
||||||
colour : this.dataColor
|
colour : this.dataColor
|
||||||
var floorstr = '';
|
var floorstr = '';
|
||||||
if (PosString_0 && PosString_1) {
|
if (PosString_0 && PosString_1) {
|
||||||
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
||||||
}
|
}
|
||||||
Int_0 = Int_0 ?(', "time": '+Int_0):'';
|
Int_0 = Int_0 ?(', "time": '+Int_0):'';
|
||||||
var code = '{"type": "jumpHero"'+floorstr+Int_0+'},\n';
|
Bool_0 = Bool_0?', "async": true':'';
|
||||||
|
var code = '{"type": "jumpHero"'+floorstr+Int_0+Bool_0+'},\n';
|
||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
@ -1910,22 +1916,22 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
case "move": // 移动事件
|
case "move": // 移动事件
|
||||||
data.loc=data.loc||['',''];
|
data.loc=data.loc||['',''];
|
||||||
this.next = MotaActionBlocks['move_s'].xmlText([
|
this.next = MotaActionBlocks['move_s'].xmlText([
|
||||||
data.loc[0],data.loc[1],data.time||0,data.keep,this.StepString(data.steps),this.next]);
|
data.loc[0],data.loc[1],data.time||0,data.keep||false,data.async||false,this.StepString(data.steps),this.next]);
|
||||||
break;
|
break;
|
||||||
case "moveHero":
|
case "moveHero":
|
||||||
this.next = MotaActionBlocks['moveHero_s'].xmlText([
|
this.next = MotaActionBlocks['moveHero_s'].xmlText([
|
||||||
data.time||0,this.StepString(data.steps),this.next]);
|
data.time||0,data.async||false,this.StepString(data.steps),this.next]);
|
||||||
break;
|
break;
|
||||||
case "jump": // 跳跃事件
|
case "jump": // 跳跃事件
|
||||||
data.from=data.from||['',''];
|
data.from=data.from||['',''];
|
||||||
data.to=data.to||['',''];
|
data.to=data.to||['',''];
|
||||||
this.next = MotaActionBlocks['jump_s'].xmlText([
|
this.next = MotaActionBlocks['jump_s'].xmlText([
|
||||||
data.from[0],data.from[1],data.to[0],data.to[1],data.time||0,data.keep,this.next]);
|
data.from[0],data.from[1],data.to[0],data.to[1],data.time||0,data.keep||false,data.async||false,this.next]);
|
||||||
break;
|
break;
|
||||||
case "jumpHero": // 跳跃勇士
|
case "jumpHero": // 跳跃勇士
|
||||||
data.loc=data.loc||['','']
|
data.loc=data.loc||['','']
|
||||||
this.next = MotaActionBlocks['jumpHero_s'].xmlText([
|
this.next = MotaActionBlocks['jumpHero_s'].xmlText([
|
||||||
data.loc[0],data.loc[1],data.time||0,this.next]);
|
data.loc[0],data.loc[1],data.time||0,data.async||false,this.next]);
|
||||||
break;
|
break;
|
||||||
case "changeFloor": // 楼层转换
|
case "changeFloor": // 楼层转换
|
||||||
data.loc=data.loc||['','']
|
data.loc=data.loc||['','']
|
||||||
|
|||||||
@ -832,12 +832,8 @@ control.prototype.moveHero = function (direction, callback) {
|
|||||||
|
|
||||||
/////// 使用事件让勇士移动。这个函数将不会触发任何事件 //////
|
/////// 使用事件让勇士移动。这个函数将不会触发任何事件 //////
|
||||||
control.prototype.eventMoveHero = function(steps, time, callback) {
|
control.prototype.eventMoveHero = function(steps, time, callback) {
|
||||||
|
|
||||||
time = time || 100;
|
time = time || 100;
|
||||||
|
|
||||||
core.clearMap('ui');
|
|
||||||
core.setAlpha('ui', 1.0);
|
|
||||||
|
|
||||||
// 要运行的轨迹:将steps展开
|
// 要运行的轨迹:将steps展开
|
||||||
var moveSteps=[];
|
var moveSteps=[];
|
||||||
steps.forEach(function (e) {
|
steps.forEach(function (e) {
|
||||||
@ -864,14 +860,11 @@ control.prototype.eventMoveHero = function(steps, time, callback) {
|
|||||||
'right': {'x': 1, 'y': 0}
|
'right': {'x': 1, 'y': 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
// core.status.replay.animate=true;
|
|
||||||
|
|
||||||
var animate=window.setInterval(function() {
|
var animate=window.setInterval(function() {
|
||||||
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y');
|
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y');
|
||||||
if (moveSteps.length==0) {
|
if (moveSteps.length==0) {
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.drawHero(null, x, y);
|
core.drawHero(null, x, y);
|
||||||
// core.status.replay.animate=false;
|
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -902,9 +895,6 @@ control.prototype.jumpHero = function (ex, ey, time, callback) {
|
|||||||
if (!core.isset(ey)) ey=sy;
|
if (!core.isset(ey)) ey=sy;
|
||||||
|
|
||||||
time = time || 500;
|
time = time || 500;
|
||||||
core.clearMap('ui');
|
|
||||||
core.setAlpha('ui', 1.0);
|
|
||||||
// core.status.replay.animate=true;
|
|
||||||
|
|
||||||
core.playSound('jump.mp3');
|
core.playSound('jump.mp3');
|
||||||
|
|
||||||
@ -954,7 +944,6 @@ control.prototype.jumpHero = function (ex, ey, time, callback) {
|
|||||||
core.setHeroLoc('x', ex);
|
core.setHeroLoc('x', ex);
|
||||||
core.setHeroLoc('y', ey);
|
core.setHeroLoc('y', ey);
|
||||||
core.drawHero();
|
core.drawHero();
|
||||||
// core.status.replay.animate=false;
|
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -598,14 +598,26 @@ events.prototype.doAction = function() {
|
|||||||
x=core.calValue(data.loc[0]);
|
x=core.calValue(data.loc[0]);
|
||||||
y=core.calValue(data.loc[1]);
|
y=core.calValue(data.loc[1]);
|
||||||
}
|
}
|
||||||
core.moveBlock(x,y,data.steps,data.time,data.keep,function() {
|
if (data.async) {
|
||||||
core.events.doAction();
|
core.moveBlock(x,y,data.steps,data.time,data.keep);
|
||||||
})
|
this.doAction();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.moveBlock(x,y,data.steps,data.time,data.keep,function() {
|
||||||
|
core.events.doAction();
|
||||||
|
})
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "moveHero":
|
case "moveHero":
|
||||||
core.eventMoveHero(data.steps,data.time,function() {
|
if (data.async) {
|
||||||
core.events.doAction();
|
core.eventMoveHero(data.steps, data.time);
|
||||||
});
|
this.doAction();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.eventMoveHero(data.steps,data.time,function() {
|
||||||
|
core.events.doAction();
|
||||||
|
});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "jump": // 跳跃事件
|
case "jump": // 跳跃事件
|
||||||
{
|
{
|
||||||
@ -618,9 +630,15 @@ events.prototype.doAction = function() {
|
|||||||
ex=core.calValue(data.to[0]);
|
ex=core.calValue(data.to[0]);
|
||||||
ey=core.calValue(data.to[1]);
|
ey=core.calValue(data.to[1]);
|
||||||
}
|
}
|
||||||
core.jumpBlock(sx,sy,ex,ey,data.time,data.keep,function() {
|
if (data.async) {
|
||||||
core.events.doAction();
|
core.jumpBlock(sx,sy,ex,ey,data.time,data.keep);
|
||||||
});
|
this.doAction();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.jumpBlock(sx,sy,ex,ey,data.time,data.keep,function() {
|
||||||
|
core.events.doAction();
|
||||||
|
});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "jumpHero":
|
case "jumpHero":
|
||||||
@ -630,9 +648,15 @@ events.prototype.doAction = function() {
|
|||||||
ex=core.calValue(data.loc[0]);
|
ex=core.calValue(data.loc[0]);
|
||||||
ey=core.calValue(data.loc[1]);
|
ey=core.calValue(data.loc[1]);
|
||||||
}
|
}
|
||||||
core.jumpHero(ex,ey,data.time,function() {
|
if (data.async) {
|
||||||
core.events.doAction();
|
core.jumpHero(ex,ey,data.time);
|
||||||
});
|
this.doAction();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.jumpHero(ex,ey,data.time,function() {
|
||||||
|
core.events.doAction();
|
||||||
|
});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "changeFloor": // 楼层转换
|
case "changeFloor": // 楼层转换
|
||||||
|
|||||||
51
libs/maps.js
51
libs/maps.js
@ -738,8 +738,6 @@ maps.prototype.getBlockCls = function (x, y, floorId, showDisable) {
|
|||||||
maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
||||||
time = time || 500;
|
time = time || 500;
|
||||||
|
|
||||||
core.clearMap('route');
|
|
||||||
|
|
||||||
var block = core.getBlock(x,y);
|
var block = core.getBlock(x,y);
|
||||||
if (block==null) {// 不存在
|
if (block==null) {// 不存在
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
@ -747,14 +745,9 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
|||||||
}
|
}
|
||||||
var id = block.block.id;
|
var id = block.block.id;
|
||||||
|
|
||||||
// core.status.replay.animate=true;
|
|
||||||
|
|
||||||
// 需要删除该块
|
// 需要删除该块
|
||||||
core.removeBlock(x,y);
|
core.removeBlock(x,y);
|
||||||
|
|
||||||
core.clearMap('ui');
|
|
||||||
core.setAlpha('ui', 1.0);
|
|
||||||
|
|
||||||
block=block.block;
|
block=block.block;
|
||||||
|
|
||||||
var image, bx, by, height = block.event.height || 32;
|
var image, bx, by, height = block.event.height || 32;
|
||||||
@ -786,8 +779,8 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
|||||||
faceIds = block.event.faceIds||{};
|
faceIds = block.event.faceIds||{};
|
||||||
}
|
}
|
||||||
|
|
||||||
var opacityVal = 1;
|
var alpha = 1;
|
||||||
core.setOpacity('route', opacityVal);
|
core.setAlpha('route', alpha);
|
||||||
core.canvas.route.drawImage(image, bx * 32, by * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height);
|
core.canvas.route.drawImage(image, bx * 32, by * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height);
|
||||||
|
|
||||||
// 要运行的轨迹:将steps展开
|
// 要运行的轨迹:将steps展开
|
||||||
@ -834,15 +827,11 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
|||||||
|
|
||||||
// 已经移动完毕,消失
|
// 已经移动完毕,消失
|
||||||
if (moveSteps.length==0) {
|
if (moveSteps.length==0) {
|
||||||
if (keep) opacityVal=0;
|
if (keep) alpha=0;
|
||||||
else opacityVal -= 0.06;
|
else alpha -= 0.06;
|
||||||
core.setOpacity('route', opacityVal);
|
|
||||||
core.clearMap('route', nowX, nowY-height+32, 32, height);
|
core.clearMap('route', nowX, nowY-height+32, 32, height);
|
||||||
core.canvas.route.drawImage(image, animateCurrent * 32, by * height, 32, height, nowX, nowY-height+32, 32, height);
|
if (alpha<=0) {
|
||||||
if (opacityVal<=0) {
|
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.clearMap('route');
|
|
||||||
core.setOpacity('route', 1);
|
|
||||||
// 不消失
|
// 不消失
|
||||||
if (keep) {
|
if (keep) {
|
||||||
core.setBlock(id, nowX/32, nowY/32);
|
core.setBlock(id, nowX/32, nowY/32);
|
||||||
@ -851,6 +840,11 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
|||||||
// core.status.replay.animate=false;
|
// core.status.replay.animate=false;
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
core.setAlpha('route', alpha);
|
||||||
|
core.canvas.route.drawImage(image, animateCurrent * 32, by * height, 32, height, nowX, nowY-height+32, 32, height);
|
||||||
|
core.setAlpha('route', 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// 移动中
|
// 移动中
|
||||||
@ -865,10 +859,10 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
core.clearMap('route', nowX, nowY-height+32, 32, height);
|
||||||
step++;
|
step++;
|
||||||
nowX+=scan[direction].x*2;
|
nowX+=scan[direction].x*2;
|
||||||
nowY+=scan[direction].y*2;
|
nowY+=scan[direction].y*2;
|
||||||
core.clearMap('route', nowX-32, nowY-32, 96, 96);
|
|
||||||
// 绘制
|
// 绘制
|
||||||
core.canvas.route.drawImage(image, animateCurrent * 32, by * height, 32, height, nowX, nowY-height+32, 32, height);
|
core.canvas.route.drawImage(image, animateCurrent * 32, by * height, 32, height, nowX, nowY-height+32, 32, height);
|
||||||
if (step==16) {
|
if (step==16) {
|
||||||
@ -883,7 +877,6 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
|||||||
////// 显示跳跃某块的动画,达到{"type":"jump"}的效果 //////
|
////// 显示跳跃某块的动画,达到{"type":"jump"}的效果 //////
|
||||||
maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
||||||
time = time || 500;
|
time = time || 500;
|
||||||
core.clearMap('route');
|
|
||||||
var block = core.getBlock(sx,sy);
|
var block = core.getBlock(sx,sy);
|
||||||
if (block==null) {
|
if (block==null) {
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
@ -891,12 +884,8 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
|||||||
}
|
}
|
||||||
var id = block.block.id;
|
var id = block.block.id;
|
||||||
|
|
||||||
// core.status.replay.animate=true;
|
|
||||||
|
|
||||||
// 需要删除该块
|
// 需要删除该块
|
||||||
core.removeBlock(sx,sy);
|
core.removeBlock(sx,sy);
|
||||||
core.clearMap('ui');
|
|
||||||
core.setAlpha('ui', 1.0);
|
|
||||||
|
|
||||||
block=block.block;
|
block=block.block;
|
||||||
var image, bx, by, height = block.event.height || 32;
|
var image, bx, by, height = block.event.height || 32;
|
||||||
@ -926,8 +915,8 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
|||||||
by = core.material.icons[block.event.cls][block.event.id];
|
by = core.material.icons[block.event.cls][block.event.id];
|
||||||
}
|
}
|
||||||
|
|
||||||
var opacityVal = 1;
|
var alpha = 1;
|
||||||
core.setOpacity('route', opacityVal);
|
core.setAlpha('route', alpha);
|
||||||
core.canvas.route.drawImage(image, bx*32, by * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height);
|
core.canvas.route.drawImage(image, bx*32, by * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height);
|
||||||
|
|
||||||
core.playSound('jump.mp3');
|
core.playSound('jump.mp3');
|
||||||
@ -977,12 +966,10 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
|||||||
core.canvas.route.drawImage(image, animateCurrent * 32, by * height, 32, height, drawX(), drawY()-height+32, 32, height);
|
core.canvas.route.drawImage(image, animateCurrent * 32, by * height, 32, height, drawX(), drawY()-height+32, 32, height);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (keep) opacityVal=0;
|
if (keep) alpha=0;
|
||||||
else opacityVal -= 0.06;
|
else alpha -= 0.06;
|
||||||
core.setOpacity('route', opacityVal);
|
|
||||||
core.clearMap('route', drawX(), drawY()-height+32, 32, height);
|
core.clearMap('route', drawX(), drawY()-height+32, 32, height);
|
||||||
core.canvas.route.drawImage(image, animateCurrent * 32, by * height, 32, height, drawX(), drawY()-height+32, 32, height);
|
if (alpha<=0) {
|
||||||
if (opacityVal<=0) {
|
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.clearMap('route');
|
core.clearMap('route');
|
||||||
core.setOpacity('route', 1);
|
core.setOpacity('route', 1);
|
||||||
@ -990,9 +977,13 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
|||||||
core.setBlock(id, ex, ey);
|
core.setBlock(id, ex, ey);
|
||||||
core.showBlock(ex, ey);
|
core.showBlock(ex, ey);
|
||||||
}
|
}
|
||||||
// core.status.replay.animate=false;
|
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
core.setAlpha('route', alpha);
|
||||||
|
core.canvas.route.drawImage(image, animateCurrent * 32, by * height, 32, height, drawX(), drawY()-height+32, 32, height);
|
||||||
|
core.setAlpha('route', 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}, time / 16 / core.status.replay.speed);
|
}, time / 16 / core.status.replay.speed);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user