diff --git a/_server/blockly/MotaAction.g4 b/_server/blockly/MotaAction.g4 index 4a9e589c..55944530 100644 --- a/_server/blockly/MotaAction.g4 +++ b/_server/blockly/MotaAction.g4 @@ -165,7 +165,7 @@ action | revisit_s | exit_s | setBlock_s - | setHero_s + | setHeroIcon_s | update_s | sleep_s | battle_s @@ -416,17 +416,17 @@ var code = '{"type": "setBlock", "number":'+Int_0+floorstr+IdString_0+'},\n'; return code; */ -setHero_s +setHeroIcon_s : '更改角色行走图' EvalString? Newline ; -/* setHero_s -tooltip : setHero:更改角色行走图 -helpUrl : https://ckcz123.github.io/mota-js/#/event?id=setHero-%e6%9b%b4%e6%94%b9%e8%a7%92%e8%89%b2%e8%a1%8c%e8%b5%b0%e5%9b%be +/* setHeroIcon_s +tooltip : setHeroIcon:更改角色行走图 +helpUrl : https://ckcz123.github.io/mota-js/#/event?id=setHeroIcon-%e6%9b%b4%e6%94%b9%e8%a7%92%e8%89%b2%e8%a1%8c%e8%b5%b0%e5%9b%be colour : this.dataColor default : ["hero.png"] EvalString_0 = EvalString_0 && (', "name": "'+EvalString_0+'"'); -var code = '{"type": "setHero"'+EvalString_0+'},\n'; +var code = '{"type": "setHeroIcon"'+EvalString_0+'},\n'; return code; */ @@ -1277,9 +1277,9 @@ ActionParser.prototype.parseAction = function() { this.next = MotaActionBlocks['setBlock_s'].xmlText([ data.number||0,data.loc[0]||'',data.loc[1]||'',data.floorId||'',this.next]); break; - case "setHero": // 改变勇士 - this.next = MotaActionBlocks['setHero_s'].xmlText([ - data.name,this.next]); + case "setHeroIcon": // 改变勇士 + this.next = MotaActionBlocks['setHeroIcon_s'].xmlText([ + data.name||"",this.next]); break; case "move": // 移动事件 data.loc=data.loc||[]; diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index abfdf2e9..3c8ff664 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -90,7 +90,7 @@ editor_blockly = function () { MotaActionBlocks['battle_s'].xmlText(), MotaActionBlocks['openDoor_s'].xmlText(), MotaActionBlocks['setBlock_s'].xmlText(), - MotaActionBlocks['setHero_s'].xmlText(), + MotaActionBlocks['setHeroIcon_s'].xmlText(), '', MotaActionBlocks['if_s'].xmlText(), MotaActionBlocks['revisit_s'].xmlText(), diff --git a/docs/event.md b/docs/event.md index ef0abda0..1d60fad1 100644 --- a/docs/event.md +++ b/docs/event.md @@ -482,14 +482,14 @@ number为**要更改到的数字**,有关“数字”的定义详见参见[素 图块更改往往与[同一个点的多事件处理](#同一个点的多事件处理)相关。 -### setHero:更改角色行走图 +### setHeroIcon:更改角色行走图 -使用`{"type": "setHero"}`可以更改角色行走图。 +使用`{"type": "setHeroIcon"}`可以更改角色行走图。 ``` js "x,y": [ // 实际执行的事件列表 - {"type": "setHero", "name": "hero2.png"}, // 将勇士行走图改成hero2.png;必须在全塔属性的images中被定义过。 - {"type": "setHero"}, // 如果不加name则恢复最初默认状态 + {"type": "setHeroIcon", "name": "hero2.png"}, // 将勇士行走图改成hero2.png;必须在全塔属性的images中被定义过。 + {"type": "setHeroIcon"}, // 如果不加name则恢复最初默认状态 {"type": "setValue", "name": "status:name", "value": "'可绒'"}, // 修改勇士名;请注意value必须加单引号。 ] ``` diff --git a/libs/events.js b/libs/events.js index fde23369..0dc626fa 100644 --- a/libs/events.js +++ b/libs/events.js @@ -569,14 +569,14 @@ events.prototype.doAction = function() { this.doAction(); } break; - case "setHero": + case "setHeroIcon": { var name = "hero.png"; if (core.isset(core.material.images.images[data.name]) && core.material.images.images[data.name].width==128) name = data.name; - core.setFlag("heroIcon", data.name); - core.material.images.hero.src = core.material.images.images[data.name].src; - core.material.icons.hero.height = core.material.images.images[data.name].height/4; + core.setFlag("heroIcon", name); + core.material.images.hero.src = core.material.images.images[name].src; + core.material.icons.hero.height = core.material.images.images[name].height/4; core.drawHero(); this.doAction(); break;