跳跃事件支持增量
This commit is contained in:
parent
d5888c49fd
commit
12d134b1dc
@ -664,7 +664,9 @@ action
|
||||
| moveAction_s
|
||||
| moveHero_s
|
||||
| jump_s
|
||||
| jump_1_s
|
||||
| jumpHero_s
|
||||
| jumpHero_1_s
|
||||
| playBgm_s
|
||||
| pauseBgm_s
|
||||
| resumeBgm_s
|
||||
@ -2069,6 +2071,31 @@ var code = '{"type": "jump"'+floorstr+''+IntString_0+Bool_0+Bool_1+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
jump_1_s
|
||||
: '跳跃事件' '起始 x' PosString? ',' 'y' PosString? '增量 dx' PosString? ',' 'dy' PosString? '动画时间' IntString? '不消失' Bool '不等待执行完毕' Bool Newline
|
||||
|
||||
|
||||
/* jump_1_s
|
||||
tooltip : jump: 让某个NPC/怪物跳跃,给定增量
|
||||
helpUrl : /_docs/#/instruction
|
||||
default : ["","","0","0",500,true,false]
|
||||
selectPoint : ["PosString_0", "PosString_1"]
|
||||
colour : this.mapColor
|
||||
|
||||
var floorstr = '';
|
||||
if (PosString_0 && PosString_1) {
|
||||
floorstr += ', "from": ['+PosString_0+','+PosString_1+']';
|
||||
}
|
||||
if (PosString_2 && PosString_3) {
|
||||
floorstr += ', "dxy": ['+PosString_2+','+PosString_3+']';
|
||||
}
|
||||
IntString_0 = IntString_0 ?(', "time": '+IntString_0):'';
|
||||
Bool_0 = Bool_0?', "keep": true':'';
|
||||
Bool_1 = Bool_1?', "async": true':'';
|
||||
var code = '{"type": "jump"'+floorstr+''+IntString_0+Bool_0+Bool_1+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
jumpHero_s
|
||||
: '跳跃勇士' 'x' PosString? ',' 'y' PosString? '动画时间' IntString? '不等待执行完毕' Bool Newline
|
||||
|
||||
@ -2089,6 +2116,25 @@ var code = '{"type": "jumpHero"'+floorstr+IntString_0+Bool_0+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
jumpHero_1_s
|
||||
: '跳跃勇士' '增量 dx' PosString? ',' 'dy' PosString? '动画时间' IntString? '不等待执行完毕' Bool Newline
|
||||
|
||||
|
||||
/* jumpHero_1_s
|
||||
tooltip : jumpHero: 跳跃勇士,给定增量
|
||||
helpUrl : /_docs/#/instruction
|
||||
default : ["0","0",500,false]
|
||||
colour : this.dataColor
|
||||
var floorstr = '';
|
||||
if (PosString_0 && PosString_1) {
|
||||
floorstr = ', "dxy": ['+PosString_0+','+PosString_1+']';
|
||||
}
|
||||
IntString_0 = IntString_0 ?(', "time": '+IntString_0):'';
|
||||
Bool_0 = Bool_0?', "async": true':'';
|
||||
var code = '{"type": "jumpHero"'+floorstr+IntString_0+Bool_0+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
playBgm_s
|
||||
: '播放背景音乐' EvalString '开始播放秒数' Int '持续到下个本事件' Bool Newline
|
||||
|
||||
|
||||
@ -401,14 +401,24 @@ ActionParser.prototype.parseAction = function() {
|
||||
break;
|
||||
case "jump": // 跳跃事件
|
||||
data.from=data.from||['',''];
|
||||
data.to=data.to||['',''];
|
||||
this.next = MotaActionBlocks['jump_s'].xmlText([
|
||||
data.from[0],data.from[1],data.to[0],data.to[1],data.time,data.keep||false,data.async||false,this.next]);
|
||||
if (data.dxy) {
|
||||
this.next = MotaActionBlocks['jump_1_s'].xmlText([
|
||||
data.from[0],data.from[1],data.dxy[0],data.dxy[1],data.time,data.keep||false,data.async||false,this.next]);
|
||||
} else {
|
||||
data.to=data.to||['',''];
|
||||
this.next = MotaActionBlocks['jump_s'].xmlText([
|
||||
data.from[0],data.from[1],data.to[0],data.to[1],data.time,data.keep||false,data.async||false,this.next]);
|
||||
}
|
||||
break;
|
||||
case "jumpHero": // 跳跃勇士
|
||||
data.loc=data.loc||['','']
|
||||
this.next = MotaActionBlocks['jumpHero_s'].xmlText([
|
||||
data.loc[0],data.loc[1],data.time,data.async||false,this.next]);
|
||||
if (data.dxy) {
|
||||
this.next = MotaActionBlocks['jumpHero_1_s'].xmlText([
|
||||
data.dxy[0],data.dxy[1],data.time,data.async||false,this.next]);
|
||||
} else {
|
||||
data.loc=data.loc||['','']
|
||||
this.next = MotaActionBlocks['jumpHero_s'].xmlText([
|
||||
data.loc[0],data.loc[1],data.time,data.async||false,this.next]);
|
||||
}
|
||||
break;
|
||||
case "changeFloor": // 楼层转换
|
||||
if (!data.loc) {
|
||||
|
||||
@ -124,6 +124,7 @@ editor_blocklyconfig=(function(){
|
||||
MotaActionBlocks['moveAction_s'].xmlText(),
|
||||
MotaActionBlocks['moveHero_s'].xmlText(),
|
||||
MotaActionBlocks['jumpHero_s'].xmlText(),
|
||||
MotaActionBlocks['jumpHero_1_s'].xmlText(),
|
||||
MotaActionBlocks['changeFloor_s'].xmlText(),
|
||||
MotaActionBlocks['changePos_s'].xmlText(),
|
||||
MotaActionBlocks['battle_s'].xmlText(),
|
||||
@ -146,6 +147,7 @@ editor_blocklyconfig=(function(){
|
||||
MotaActionBlocks['turnBlock_s'].xmlText(),
|
||||
MotaActionBlocks['move_s'].xmlText(),
|
||||
MotaActionBlocks['jump_s'].xmlText(),
|
||||
MotaActionBlocks['jump_1_s'].xmlText(),
|
||||
MotaActionBlocks['showBgFgMap_s'].xmlText(),
|
||||
MotaActionBlocks['hideBgFgMap_s'].xmlText(),
|
||||
MotaActionBlocks['setBgFgBlock_s'].xmlText(),
|
||||
|
||||
@ -1464,19 +1464,29 @@ events.prototype._action_moveHero = function (data, x, y, prefix) {
|
||||
}
|
||||
|
||||
events.prototype._action_jump = function (data, x, y, prefix) {
|
||||
var from = this.__action_getLoc(data.from, x, y, prefix),
|
||||
var from = this.__action_getLoc(data.from, x, y, prefix), to;
|
||||
if (data.dxy) {
|
||||
to = [from[0] + (core.calValue(data.dxy[0], prefix) || 0), from[1] + (core.calValue(data.dxy[1], prefix) || 0)];
|
||||
} else {
|
||||
to = this.__action_getLoc(data.to, x, y, prefix);
|
||||
}
|
||||
this.__action_doAsyncFunc(data.async, core.jumpBlock, from[0], from[1], to[0], to[1], data.time, data.keep);
|
||||
}
|
||||
|
||||
events.prototype._precompile_jump = function (data) {
|
||||
data.from = this.__precompile_array(data.from);
|
||||
data.to = this.__precompile_array(data.to);
|
||||
data.dxy = this.__precompile_array(data.dxy);
|
||||
return data;
|
||||
}
|
||||
|
||||
events.prototype._action_jumpHero = function (data, x, y, prefix) {
|
||||
var loc = this.__action_getHeroLoc(data.loc, prefix);
|
||||
var loc;
|
||||
if (data.dxy) {
|
||||
loc = [core.getHeroLoc('x') + (core.calValue(data.dxy[0], prefix) || 0), core.getHeroLoc('y') + (core.calValue(data.dxy[1], prefix) || 0)];
|
||||
} else {
|
||||
loc = this.__action_getHeroLoc(data.loc, prefix);
|
||||
}
|
||||
this.__action_doAsyncFunc(data.async, core.jumpHero, loc[0], loc[1], data.time);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user