commit
d8e00e9b4d
78
V2.0版本简易造塔流程(For新人).txt
Normal file
78
V2.0版本简易造塔流程(For新人).txt
Normal file
@ -0,0 +1,78 @@
|
||||
这只是一个最简单的造塔流程,更为详细的还是请参见视频或教程文档。
|
||||
|
||||
1. 打开启动服务,地图编辑器。
|
||||
|
||||
2. 切换到MT0层,然后开始绘制地图。可以在上面放置墙、门、道具或怪物等。
|
||||
如果提示“该素材未被定义”,请参见第7点。
|
||||
如果要从RMXP中复刻已有的塔的地图,请参见第11点。
|
||||
|
||||
3. 切换到楼层属性,一项一项仔细进行楼层属性的编辑,如楼层名,firstArrive等等。
|
||||
将鼠标移动到表格的中间可以查看详细信息。
|
||||
firstArrive为初次到达楼层的事件,可以双击进行事件的编辑。有关事件请详见文档。
|
||||
|
||||
3. 输入怪物数据:点击右边怪物,然后左边写怪物的攻防血等数值。
|
||||
将鼠标移动到表格的中间可以查看详细信息。
|
||||
如果是特殊属性怪物直接写特殊编号,多个特殊属性可以用 [1,2] 来表示。
|
||||
|
||||
4. 在中间的下拉框切换全塔属性,一项一项仔细进行根据需求编辑。
|
||||
请注意"name"一项必须修改为“字母、数字、下划线组成的字符串”,否则会出现串档问题。
|
||||
startText(初始剧情)、shops(全局商店)、levelUp(升级)等都是可以双击方框进行编辑的。
|
||||
有关全局商店和升级等信息详见 教程文档 - 事件
|
||||
|
||||
5. 给地图添加事件;可以给地图上的NPC增加事件,或者战斗/开门事件等。
|
||||
点击地图上的某个点,在左边进行编辑。
|
||||
event -- 该点的自定义事件(例如NPC,商店,等等)
|
||||
changeFloor -- 该点的楼层传送事件(楼梯/传送门)
|
||||
afterBattle -- 该点战斗后触发的战后事件
|
||||
afterOpenDoor -- 该点开门后触发的事件
|
||||
afterGetItem -- 该点获得道具后触发的事件
|
||||
等等。
|
||||
有关事件详细内容请参见 文档 - 事件。
|
||||
|
||||
6. 新建楼层:切换到地图编辑,然后在框内输入新楼层的floorId,点击新建地图即可保存。
|
||||
创建的floorId必须是字母、数字和下划线组成,且不能以数字开头。
|
||||
不能为空白,不能和任何已有楼层的floorId重复。
|
||||
保存成功后刷新页面。
|
||||
|
||||
删除楼层同理,不过请注意删除的会是当前的楼层而不是框中的内容。
|
||||
|
||||
7. 关于素材未被定义的问题:如果点击某个怪物或NPC提示该素材未被定义,请在左边进行素材的注册。
|
||||
输入该素材的唯一ID(不能和其他素材的ID重复),和素材的唯一数字(1000以内,不能和其他的数字重复),
|
||||
保存并刷新,即注册成功。
|
||||
|
||||
8. 添加新素材:请打开启动服务的便捷PS工具,然后左边读取你要添加到的图片(比如怪物是enemys.png,道具是items.png),
|
||||
右边读取你要导入的怪物素材,通过复制粘贴进行导入,再保存,刷新页面后按照第7点来进行素材的注册。
|
||||
|
||||
9. 道具的自定义效果:如果需要自定义道具效果,请仿照其他的几个道具来写,更多信息详见文档。
|
||||
|
||||
10. 报错处理:有时候刷新后可能页面变成空白,即无法正确加载。
|
||||
出现这种问题的原因往往是手动错误编辑了文件、新建楼层使用了不合法的floorId(比如中文或数字)、楼层floorId定义重复,等等。
|
||||
|
||||
出现这种问题,(在Chrome浏览器中)请按Ctrl+Shift+I打开控制台,找到Console查看报错。
|
||||
一般都会具体到哪个楼层文件出错。
|
||||
|
||||
解决方式:哪个楼层文件出错,请使用VSCode等打开project目录下的data.js文件,并将出错的那个楼层定义删除。
|
||||
|
||||
举例,比如我在新建地图中写了 “水潭边” 这样一个楼层名(中文),然后新建并保存,刷新会出错。
|
||||
此时,打开控制台(Ctrl+Shift+I的Console),并查看报错,发现是该楼层错误。
|
||||
那么打开data.js文件,并将 "floorIds": [..., "水潭边"] 这里对它的楼层定义删除,再刷新即可。
|
||||
|
||||
11. 从RMXP中导入已有的塔的地图。
|
||||
如果你想复刻老塔,则需使用启动服务的地图生成器。
|
||||
请确保老地图中的所有使用素材(地面/墙壁/门/道具/怪物等等)都已经被注册过(参见第7点)。
|
||||
|
||||
打开windows自带的截图工具,并对地图进行截图。
|
||||
截图时请注意:必须截刚好13x13范围大小的地图,尽量对其边缘进行截取。
|
||||
如果不是13x13的范围大小,可能会导致地图生成器无响应。
|
||||
截图完毕后,请复制到剪切板,然后在地图生成器中点加载图片。等1-2秒,就可以看到截图被识别。
|
||||
点“复制地图”,然后在地图编辑器中切换到“地图编辑”,并粘贴到左边的框内,即可。
|
||||
如果存在个别识别问题,可以对这个别素材再进行重新绘制。
|
||||
|
||||
如果出现大量识别问题,比如基本全是错的,则代表你的截图方式有问题。
|
||||
由于地图生成器的识别以左上角的图块为基准来找寻截图偏移量,请确保左上角一定要是一个能被很好识别的图块。
|
||||
建议:在RM的图层第三层,左上角放一个岩浆,再进行截图(保证截图的13x13的左上角是岩浆,从而可以确保定位),
|
||||
识别后再复制到地图编辑器中进行绘制。
|
||||
|
||||
--------------------------------
|
||||
|
||||
HTML5魔塔交流群:539113091,如果有问题请加群提问。
|
||||
2
_server/blockly/Converter.bundle.min.js
vendored
2
_server/blockly/Converter.bundle.min.js
vendored
File diff suppressed because one or more lines are too long
@ -5,22 +5,22 @@ grammar MotaAction;
|
||||
|
||||
//事件 事件编辑器入口之一
|
||||
event_m
|
||||
: '事件' BGNL? Newline '覆盖触发器' Bool '启用' Bool '通行状态' B_List '显伤' Bool BGNL? Newline action+ BEND
|
||||
: '事件' BGNL? Newline '覆盖触发器' Bool '启用' Bool '通行状态' B_0_List '显伤' Bool BGNL? Newline action+ BEND
|
||||
;
|
||||
|
||||
/* event_m
|
||||
tooltip : 编辑魔塔的事件
|
||||
helpUrl : https://ckcz123.github.io/mota-js/#/event
|
||||
default : [false,null,[['不改变','null'],['不可通行','true'],['可以通行','false']],null]
|
||||
B_List_0=eval(B_List_0);
|
||||
default : [false,null,null,null]
|
||||
B_0_List_0=eval(B_0_List_0);
|
||||
var code = {
|
||||
'trigger': Bool_0?'action':null,
|
||||
'enable': Bool_1,
|
||||
'noPass': B_List_0,
|
||||
'noPass': B_0_List_0,
|
||||
'displayDamage': Bool_2,
|
||||
'data': 'data_asdfefw'
|
||||
}
|
||||
if (!Bool_0 && Bool_1 && (B_List_0===null) && Bool_2) code = 'data_asdfefw';
|
||||
if (!Bool_0 && Bool_1 && (B_0_List_0===null) && Bool_2) code = 'data_asdfefw';
|
||||
code=JSON.stringify(code,null,2).split('"data_asdfefw"').join('[\n'+action_0+']\n');
|
||||
return code;
|
||||
*/
|
||||
@ -39,10 +39,34 @@ return code;
|
||||
|
||||
//商店 事件编辑器入口之一
|
||||
shop_m
|
||||
: '全局商店列表' BGNL? Newline shoplist+
|
||||
;
|
||||
/* shop_m
|
||||
tooltip : 全局商店列表
|
||||
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97
|
||||
var code = '['+shoplist_0+']\n';
|
||||
return code;
|
||||
*/
|
||||
|
||||
shoplist
|
||||
: shopsub
|
||||
| emptyshop
|
||||
;
|
||||
|
||||
emptyshop
|
||||
: Newline
|
||||
;
|
||||
|
||||
/* emptyshop
|
||||
var code = ' \n';
|
||||
return code;
|
||||
*/
|
||||
|
||||
shopsub
|
||||
: '商店 id' IdString '标题' EvalString '图标' IdString BGNL? Newline '快捷商店栏中名称' EvalString BGNL? Newline '使用' ShopUse_List '消耗' EvalString BGNL? Newline '显示文字' EvalString BGNL? Newline shopChoices+ BEND
|
||||
;
|
||||
|
||||
/* shop_m
|
||||
/* shopsub
|
||||
tooltip : 全局商店,消耗填-1表示每个选项的消耗不同,正数表示消耗数值
|
||||
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97
|
||||
default : ["shop1","贪婪之神","blueShop","1F金币商店",null,"20+10*times*(times+1)","勇敢的武士啊, 给我${need}金币就可以:"]
|
||||
@ -56,7 +80,7 @@ var code = {
|
||||
'text': EvalString_3,
|
||||
'choices': 'choices_asdfefw'
|
||||
}
|
||||
code=JSON.stringify(code,null,2).split('"choices_asdfefw"').join('[\n'+shopChoices_0+']\n');
|
||||
code=JSON.stringify(code,null,2).split('"choices_asdfefw"').join('[\n'+shopChoices_0+']\n')+',\n';
|
||||
return code;
|
||||
*/
|
||||
|
||||
@ -140,7 +164,7 @@ changeFloor_m
|
||||
/* changeFloor_m
|
||||
tooltip : 楼梯, 传送门, 如果目标楼层有多个楼梯, 写upFloor或downFloor可能会导致到达的楼梯不确定, 这时候请使用loc方式来指定具体的点位置
|
||||
helpUrl : https://ckcz123.github.io/mota-js/#/element?id=%e8%b7%af%e9%9a%9c%ef%bc%8c%e6%a5%bc%e6%a2%af%ef%bc%8c%e4%bc%a0%e9%80%81%e9%97%a8
|
||||
default : ["MT1",null,0,0,[['不变',''],['上','up'],['下','down'],['左','left'],['右','right']],500,null]
|
||||
default : ["MT1",null,0,0,null,500,null]
|
||||
var loc = ', "loc": ['+Number_0+', '+Number_1+']';
|
||||
if (Stair_List_0!=='loc')loc = ', "stair": "'+Stair_List_0+'"';
|
||||
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
|
||||
@ -168,6 +192,7 @@ action
|
||||
| setHeroIcon_s
|
||||
| update_s
|
||||
| sleep_s
|
||||
| wait_s
|
||||
| battle_s
|
||||
| openDoor_s
|
||||
| changeFloor_s
|
||||
@ -261,13 +286,13 @@ return code;
|
||||
*/
|
||||
|
||||
setText_s
|
||||
: '设置剧情文本的属性' '位置' SetTextPosition_List BGNL? '标题颜色' EvalString? '正文颜色' EvalString? '背景色' EvalString? BGNL? '粗体' B_List '打字间隔' EvalString? Newline
|
||||
: '设置剧情文本的属性' '位置' SetTextPosition_List BGNL? '标题颜色' EvalString? '正文颜色' EvalString? '背景色' EvalString? BGNL? '粗体' B_1_List '打字间隔' EvalString? Newline
|
||||
;
|
||||
|
||||
/* setText_s
|
||||
tooltip : setText:设置剧情文本的属性,颜色为RGB三元组或RGBA四元组,打字间隔为剧情文字添加的时间间隔,为整数或不填
|
||||
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=settext%ef%bc%9a%e8%ae%be%e7%bd%ae%e5%89%a7%e6%83%85%e6%96%87%e6%9c%ac%e7%9a%84%e5%b1%9e%e6%80%a7
|
||||
default : [[['不改变','null'],['上','up'],['中','center'],['下','down']],"","","",[['不改变','null'],['设为粗体','true'],['取消粗体','false']],'']
|
||||
default : [null,"","","",null,'']
|
||||
SetTextPosition_List_0 =SetTextPosition_List_0==='null'?'': ', "position": "'+SetTextPosition_List_0+'"';
|
||||
var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
|
||||
if (EvalString_0) {
|
||||
@ -286,8 +311,8 @@ if (EvalString_3) {
|
||||
if (!/^\d+$/.test(EvalString_3))throw new Error('打字时间间隔必须是整数或不填');
|
||||
EvalString_3 = ', "time": '+EvalString_3;
|
||||
}
|
||||
B_List_0 = ', "bold": '+B_List_0;
|
||||
var code = '{"type": "setText"'+SetTextPosition_List_0+EvalString_0+EvalString_1+EvalString_2+B_List_0+EvalString_3+'},\n';
|
||||
B_1_List_0 = ', "bold": '+B_1_List_0;
|
||||
var code = '{"type": "setText"'+SetTextPosition_List_0+EvalString_0+EvalString_1+EvalString_2+B_1_List_0+EvalString_3+'},\n';
|
||||
return code;
|
||||
*/
|
||||
|
||||
@ -325,12 +350,19 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=show-%e5%b0%86%e4%b8%80%e
|
||||
default : ["0","0","",500]
|
||||
colour : this.eventColor
|
||||
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
|
||||
var pattern = /^([+-]?\d+)(,[+-]?\d+)*$/;
|
||||
if(!pattern.test(EvalString_0) || !pattern.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
|
||||
EvalString_0=EvalString_0.split(',');
|
||||
EvalString_1=EvalString_1.split(',');
|
||||
if(EvalString_0.length!==EvalString_1.length)throw new Error('坐标格式错误,请右键点击帮助查看格式');
|
||||
for(var ii=0;ii<EvalString_0.length;ii++)EvalString_0[ii]='['+EvalString_0[ii]+','+EvalString_1[ii]+']';
|
||||
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
|
||||
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
||||
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
||||
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
||||
EvalString_0=[EvalString_0,EvalString_1]
|
||||
} else {
|
||||
var pattern2 = /^([+-]?\d+)(,[+-]?\d+)*$/;
|
||||
if(!pattern2.test(EvalString_0) || !pattern2.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
|
||||
EvalString_0=EvalString_0.split(',');
|
||||
EvalString_1=EvalString_1.split(',');
|
||||
if(EvalString_0.length!==EvalString_1.length)throw new Error('坐标格式错误,请右键点击帮助查看格式');
|
||||
for(var ii=0;ii<EvalString_0.length;ii++)EvalString_0[ii]='['+EvalString_0[ii]+','+EvalString_1[ii]+']';
|
||||
}
|
||||
Int_0 = Int_0 ?(', "time": '+Int_0):'';
|
||||
var code = '{"type": "show", "loc": ['+EvalString_0.join(',')+']'+IdString_0+''+Int_0+'},\n';
|
||||
return code;
|
||||
@ -347,13 +379,20 @@ default : ["","","",500]
|
||||
colour : this.eventColor
|
||||
var floorstr = '';
|
||||
if (EvalString_0 && EvalString_1) {
|
||||
var pattern = /^([+-]?\d+)(,[+-]?\d+)*$/;
|
||||
if(!pattern.test(EvalString_0) || !pattern.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
|
||||
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
|
||||
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
||||
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
||||
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
||||
EvalString_0=[EvalString_0,EvalString_1]
|
||||
} else {
|
||||
var pattern2 = /^([+-]?\d+)(,[+-]?\d+)*$/;
|
||||
if(!pattern2.test(EvalString_0) || !pattern2.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
|
||||
EvalString_0=EvalString_0.split(',');
|
||||
EvalString_1=EvalString_1.split(',');
|
||||
if(EvalString_0.length!==EvalString_1.length)throw new Error('坐标格式错误,请右键点击帮助查看格式');
|
||||
for(var ii=0;ii<EvalString_0.length;ii++)EvalString_0[ii]='['+EvalString_0[ii]+','+EvalString_1[ii]+']';
|
||||
floorstr = ', "loc": ['+EvalString_0.join(',')+']';
|
||||
}
|
||||
floorstr = ', "loc": ['+EvalString_0.join(',')+']';
|
||||
}
|
||||
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
|
||||
Int_0 = Int_0 ?(', "time": '+Int_0):'';
|
||||
@ -362,7 +401,7 @@ return code;
|
||||
*/
|
||||
|
||||
trigger_s
|
||||
: '触发事件' 'x' Int ',' 'y' Int Newline
|
||||
: '触发事件' 'x' PosString ',' 'y' PosString Newline
|
||||
;
|
||||
|
||||
/* trigger_s
|
||||
@ -370,7 +409,7 @@ tooltip : trigger: 立即触发另一个地点的事件
|
||||
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=trigger-%e7%ab%8b%e5%8d%b3%e8%a7%a6%e5%8f%91%e5%8f%a6%e4%b8%80%e4%b8%aa%e5%9c%b0%e7%82%b9%e7%9a%84%e4%ba%8b%e4%bb%b6
|
||||
default : [0,0]
|
||||
colour : this.eventColor
|
||||
var code = '{"type": "trigger", "loc": ['+Int_0+','+Int_1+']},\n';
|
||||
var code = '{"type": "trigger", "loc": ['+PosString_0+','+PosString_1+']},\n';
|
||||
return code;
|
||||
*/
|
||||
|
||||
@ -399,7 +438,7 @@ return code;
|
||||
*/
|
||||
|
||||
setBlock_s
|
||||
: '转变图块为' Int 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? Newline
|
||||
: '转变图块为' Int 'x' PosString? ',' 'y' PosString? '楼层' IdString? Newline
|
||||
;
|
||||
|
||||
/* setBlock_s
|
||||
@ -408,8 +447,8 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=setblock%ef%bc%9a%e8%ae%b
|
||||
colour : this.dataColor
|
||||
default : [0,"","",""]
|
||||
var floorstr = '';
|
||||
if (EvalString_0 && EvalString_1) {
|
||||
floorstr = ', "loc": ['+EvalString_0+','+EvalString_1+']';
|
||||
if (PosString_0 && PosString_1) {
|
||||
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
||||
}
|
||||
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
|
||||
var code = '{"type": "setBlock", "number":'+Int_0+floorstr+IdString_0+'},\n';
|
||||
@ -455,6 +494,18 @@ var code = '{"type": "sleep", "time": '+Int_0+'},\n';
|
||||
return code;
|
||||
*/
|
||||
|
||||
wait_s
|
||||
: '等待用户操作'
|
||||
;
|
||||
|
||||
/* wait_s
|
||||
tooltip : wait: 等待用户操作
|
||||
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=wait-%e7%ad%89%e5%be%85%e7%94%a8%e6%88%b7%e6%93%8d%e4%bd%9c
|
||||
colour : this.soundColor
|
||||
var code = '{"type": "wait"},\n';
|
||||
return code;
|
||||
*/
|
||||
|
||||
battle_s
|
||||
: '强制战斗' IdString Newline
|
||||
;
|
||||
@ -469,7 +520,7 @@ return code;
|
||||
*/
|
||||
|
||||
openDoor_s
|
||||
: '开门' 'x' Int ',' 'y' Int '楼层' IdString? Newline
|
||||
: '开门' 'x' PosString ',' 'y' PosString '楼层' IdString? Newline
|
||||
;
|
||||
|
||||
/* openDoor_s
|
||||
@ -478,36 +529,36 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=opendoor-%e5%bc%80%e9%97%
|
||||
default : [0,0,""]
|
||||
colour : this.dataColor
|
||||
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
|
||||
var code = '{"type": "openDoor", "loc": ['+Int_0+','+Int_1+']'+IdString_0+'},\n';
|
||||
var code = '{"type": "openDoor", "loc": ['+PosString_0+','+PosString_1+']'+IdString_0+'},\n';
|
||||
return code;
|
||||
*/
|
||||
|
||||
changeFloor_s
|
||||
: '楼层切换' IdString 'x' Number ',' 'y' Number '朝向' DirectionEx_List '动画时间' Int? Newline
|
||||
: '楼层切换' IdString 'x' PosString ',' 'y' PosString '朝向' DirectionEx_List '动画时间' Int? Newline
|
||||
;
|
||||
|
||||
/* changeFloor_s
|
||||
tooltip : changeFloor: 楼层切换,动画时间可不填
|
||||
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=changefloor-%e6%a5%bc%e5%b1%82%e5%88%87%e6%8d%a2
|
||||
default : ["MT1",0,0,[['不变',''],['上','up'],['下','down'],['左','left'],['右','right']],500]
|
||||
default : ["MT1",0,0,null,500]
|
||||
colour : this.dataColor
|
||||
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
|
||||
Int_0 = Int_0 ?(', "time": '+Int_0):'';
|
||||
var code = '{"type": "changeFloor", "floorId": "'+IdString_0+'", "loc": ['+Number_0+', '+Number_1+']'+DirectionEx_List_0+Int_0+' },\n';
|
||||
var code = '{"type": "changeFloor", "floorId": "'+IdString_0+'", "loc": ['+PosString_0+', '+PosString_1+']'+DirectionEx_List_0+Int_0+' },\n';
|
||||
return code;
|
||||
*/
|
||||
|
||||
changePos_0_s
|
||||
: '位置切换' 'x' Number ',' 'y' Number '朝向' DirectionEx_List Newline
|
||||
: '位置切换' 'x' PosString ',' 'y' PosString '朝向' DirectionEx_List Newline
|
||||
;
|
||||
|
||||
/* changePos_0_s
|
||||
tooltip : changePos: 当前位置切换
|
||||
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=changepos-%e5%bd%93%e5%89%8d%e4%bd%8d%e7%bd%ae%e5%88%87%e6%8d%a2%e5%8b%87%e5%a3%ab%e8%bd%ac%e5%90%91
|
||||
default : [0,0,[['不变',''],['上','up'],['下','down'],['左','left'],['右','right']]]
|
||||
default : [0,0,null]
|
||||
colour : this.dataColor
|
||||
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
|
||||
var code = '{"type": "changePos", "loc": ['+Number_0+','+Number_1+']'+DirectionEx_List_0+'},\n';
|
||||
var code = '{"type": "changePos", "loc": ['+PosString_0+','+PosString_1+']'+DirectionEx_List_0+'},\n';
|
||||
return code;
|
||||
*/
|
||||
|
||||
@ -519,7 +570,7 @@ changePos_1_s
|
||||
tooltip : changePos: 勇士转向
|
||||
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=changepos-%e5%bd%93%e5%89%8d%e4%bd%8d%e7%bd%ae%e5%88%87%e6%8d%a2%e5%8b%87%e5%a3%ab%e8%bd%ac%e5%90%91
|
||||
colour : this.dataColor
|
||||
default : [[['上','up'],['下','down'],['左','left'],['右','right']]]
|
||||
default : [null]
|
||||
var code = '{"type": "changePos", "direction": "'+Direction_List_0+'"},\n';
|
||||
return code;
|
||||
*/
|
||||
@ -559,7 +610,9 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=animate%ef%bc%9a%e6%98%be
|
||||
default : ["zone","hero"]
|
||||
colour : this.soundColor
|
||||
if (EvalString_0) {
|
||||
if(/hero|([+-]?\d+),([+-]?\d+)/.test(EvalString_0)) {
|
||||
if(/^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-]*,flag:[0-9a-zA-Z_][0-9a-zA-Z_\-]*$/.test(EvalString_0)) {
|
||||
EvalString_0=', "loc": ["'+EvalString_0.split(',').join('","')+'"]';
|
||||
} else if (/hero|([+-]?\d+),([+-]?\d+)/.test(EvalString_0)) {
|
||||
if(EvalString_0.indexOf(',')!==-1)EvalString_0='['+EvalString_0+']';
|
||||
else EvalString_0='"'+EvalString_0+'"';
|
||||
EvalString_0 = ', "loc": '+EvalString_0;
|
||||
@ -572,7 +625,7 @@ return code;
|
||||
*/
|
||||
|
||||
showImage_0_s
|
||||
: '显示图片' EvalString '起点像素位置' 'x' Number 'y' Number Newline
|
||||
: '显示图片' EvalString '起点像素位置' 'x' PosString 'y' PosString Newline
|
||||
;
|
||||
|
||||
/* showImage_0_s
|
||||
@ -580,7 +633,7 @@ tooltip : showImage:显示图片
|
||||
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=showimage%ef%bc%9a%e6%98%be%e7%a4%ba%e5%9b%be%e7%89%87
|
||||
default : ["bg.jpg",0,0]
|
||||
colour : this.printColor
|
||||
var code = '{"type": "showImage", "name": "'+EvalString_0+'", "loc": ['+Number_0+','+Number_1+']},\n';
|
||||
var code = '{"type": "showImage", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+']},\n';
|
||||
return code;
|
||||
*/
|
||||
|
||||
@ -695,12 +748,12 @@ default : [null,1]
|
||||
colour : this.soundColor
|
||||
if(Int_0<1 || Int_0>10) throw new Error('天气的强度等级, 在1-10之间');
|
||||
var code = '{"type": "setWeather", "name": "'+Weather_List_0+'", "level": '+Int_0+'},\n';
|
||||
if(Weather_List_0==='无')code = '{"type": "setWeather"},\n';
|
||||
if(Weather_List_0==='')code = '{"type": "setWeather"},\n';
|
||||
return code;
|
||||
*/
|
||||
|
||||
move_s
|
||||
: '移动事件' 'x' EvalString? ',' 'y' EvalString? '动画时间' Int? '消失时无动画时间' Bool BGNL? StepString Newline
|
||||
: '移动事件' 'x' PosString? ',' 'y' PosString? '动画时间' Int? '消失时无动画时间' Bool BGNL? StepString Newline
|
||||
;
|
||||
|
||||
/* move_s
|
||||
@ -709,8 +762,8 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=move-%e8%ae%a9%e6%9f%90%e
|
||||
default : ["","",500,null,"上右3下2左上左2"]
|
||||
colour : this.eventColor
|
||||
var floorstr = '';
|
||||
if (EvalString_0 && EvalString_1) {
|
||||
floorstr = ', "loc": ['+EvalString_0+','+EvalString_1+']';
|
||||
if (PosString_0 && PosString_1) {
|
||||
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
||||
}
|
||||
Int_0 = Int_0 ?(', "time": '+Int_0):'';
|
||||
var code = '{"type": "move"'+floorstr+''+Int_0+', "steps": '+JSON.stringify(StepString_0)+', "immediateHide": '+Bool_0+'},\n';
|
||||
@ -1006,31 +1059,37 @@ RawEvalString
|
||||
: 'sdeirughvuiyasdbe'+ //为了被识别为复杂词法规则
|
||||
;
|
||||
|
||||
Stair_List
|
||||
: 'loc'|'upFloor'|'downFloor'
|
||||
PosString
|
||||
: 'sdeirughvuiyasbde'+ //为了被识别为复杂词法规则
|
||||
;
|
||||
|
||||
Stair_List
|
||||
: '坐标'|'上楼'|'下楼'
|
||||
/*Stair_List ['loc','upFloor','downFloor']*/;
|
||||
|
||||
SetTextPosition_List
|
||||
: 'null'|'center'|'up'|'down'
|
||||
;
|
||||
: '不改变'|'上'|'中'|'下'
|
||||
/*SetTextPosition_List ['null','up','center','down']*/;
|
||||
|
||||
ShopUse_List
|
||||
: 'money' | 'experience'
|
||||
;
|
||||
: '金币' | '经验'
|
||||
/*ShopUse_List ['money','experience']*/;
|
||||
|
||||
Arithmetic_List
|
||||
: '+'|'-'|'*'|'/'|'^'|'=='|'!='|'>'|'<'|'>='|'<='|'和'|'或'
|
||||
;
|
||||
|
||||
Weather_List
|
||||
: '无'|'rain'|'snow'
|
||||
;
|
||||
: '无'|'雨'|'雪'
|
||||
/*Weather_List ['','rain','snow']*/;
|
||||
|
||||
B_List
|
||||
: 'null'
|
||||
| 'true'
|
||||
| 'false'
|
||||
;
|
||||
B_0_List
|
||||
: '不改变'|'不可通行'|'可以通行'
|
||||
/*B_0_List ['null','true','false']*/;
|
||||
|
||||
B_1_List
|
||||
: '不改变'|'设为粗体'|'取消粗体'
|
||||
/*B_1_List ['null','true','false']*/;
|
||||
|
||||
Bool: 'TRUE'
|
||||
| 'FALSE'
|
||||
@ -1047,11 +1106,11 @@ fragment EXP : [Ee] [+\-]? Int ; // \- since - means "range" inside [...]
|
||||
|
||||
Direction_List
|
||||
: '上'|'下'|'左'|'右'
|
||||
;
|
||||
/*Direction_List ['up','down','left','right']*/;
|
||||
|
||||
DirectionEx_List
|
||||
: '不变'|'上'|'下'|'左'|'右'
|
||||
;
|
||||
/*DirectionEx_List ['','up','down','left','right']*/;
|
||||
|
||||
StepString
|
||||
: (Direction_List Int?)+
|
||||
@ -1161,25 +1220,33 @@ ActionParser.prototype.parse = function (obj,type) {
|
||||
return MotaActionBlocks['point_m'].xmlText([text_choices]);
|
||||
|
||||
case 'shop':
|
||||
var text_choices = null;
|
||||
for(var ii=obj.choices.length-1,choice;choice=obj.choices[ii];ii--) {
|
||||
var text_effect = null;
|
||||
var effectList = choice.effect.split(';');
|
||||
for(var jj=effectList.length-1,effect;effect=effectList[jj];jj--) {
|
||||
if(effect.split('+=').length!==2){
|
||||
throw new Error('一个商店效果中必须包含恰好一个"+="');
|
||||
var buildsub = function(obj,parser,next){
|
||||
var text_choices = null;
|
||||
for(var ii=obj.choices.length-1,choice;choice=obj.choices[ii];ii--) {
|
||||
var text_effect = null;
|
||||
var effectList = choice.effect.split(';');
|
||||
for(var jj=effectList.length-1,effect;effect=effectList[jj];jj--) {
|
||||
if(effect.split('+=').length!==2){
|
||||
throw new Error('一个商店效果中必须包含恰好一个"+="');
|
||||
}
|
||||
text_effect=MotaActionBlocks['shopEffect'].xmlText([
|
||||
MotaActionBlocks['idString_e'].xmlText([effect.split('+=')[0]]),
|
||||
MotaActionBlocks['evalString_e'].xmlText([effect.split('+=')[1]]),
|
||||
text_effect]);
|
||||
}
|
||||
text_effect=MotaActionBlocks['shopEffect'].xmlText([
|
||||
MotaActionBlocks['idString_e'].xmlText([effect.split('+=')[0]]),
|
||||
MotaActionBlocks['evalString_e'].xmlText([effect.split('+=')[1]]),
|
||||
text_effect]);
|
||||
text_choices=MotaActionBlocks['shopChoices'].xmlText([
|
||||
choice.text,choice.need||'',text_effect,text_choices]);
|
||||
}
|
||||
text_choices=MotaActionBlocks['shopChoices'].xmlText([
|
||||
choice.text,choice.need||'',text_effect,text_choices]);
|
||||
return MotaActionBlocks['shopsub'].xmlText([
|
||||
obj.id,obj.name,obj.icon,obj.textInList,obj.use,obj.need,parser.EvalString(obj.text),text_choices,next
|
||||
]);
|
||||
}
|
||||
return MotaActionBlocks['shop_m'].xmlText([
|
||||
obj.id,obj.name,obj.icon,obj.textInList,obj.use,obj.need,this.EvalString(obj.text),text_choices
|
||||
]);
|
||||
var next=null;
|
||||
if(!obj)obj=[];
|
||||
while(obj.length){
|
||||
next=buildsub(obj.pop(),this,next);
|
||||
}
|
||||
return MotaActionBlocks['shop_m'].xmlText([next]);
|
||||
|
||||
default:
|
||||
return MotaActionBlocks[type+'_m'].xmlText([this.parseList(obj)]);
|
||||
@ -1250,7 +1317,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
this.parseAction();
|
||||
break;
|
||||
case "show": // 显示
|
||||
if (typeof data.loc[0] == 'number' && typeof data.loc[1] == 'number')
|
||||
if (!(data.loc[0] instanceof Array))
|
||||
data.loc = [data.loc];
|
||||
var x_str=[],y_str=[];
|
||||
data.loc.forEach(function (t) {
|
||||
@ -1262,7 +1329,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
break;
|
||||
case "hide": // 消失
|
||||
data.loc=data.loc||[];
|
||||
if (typeof data.loc[0] == 'number' && typeof data.loc[1] == 'number')
|
||||
if (!(data.loc[0] instanceof Array))
|
||||
data.loc = [data.loc];
|
||||
var x_str=[],y_str=[];
|
||||
data.loc.forEach(function (t) {
|
||||
@ -1433,6 +1500,10 @@ ActionParser.prototype.parseAction = function() {
|
||||
this.next = MotaActionBlocks['sleep_s'].xmlText([
|
||||
data.time,this.next]);
|
||||
break;
|
||||
case "wait": // 等待用户操作
|
||||
this.next = MotaActionBlocks['wait_s'].xmlText([
|
||||
this.next]);
|
||||
break;
|
||||
case "revisit": // 立刻重新执行该事件
|
||||
this.next = MotaActionBlocks['revisit_s'].xmlText([
|
||||
this.next]);
|
||||
@ -1511,6 +1582,12 @@ MotaActionFunctions.IdString_pre = function(IdString){
|
||||
return IdString;
|
||||
}
|
||||
|
||||
MotaActionFunctions.PosString_pre = function(PosString){
|
||||
if (!PosString || /^-?\d+$/.test(PosString)) return PosString;
|
||||
if (!(/^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/.test(PosString)))throw new Error(PosString+'中包含了0-9 a-z A-Z _ - :之外的字符,或者是没有以flag: 开头');
|
||||
return '"'+PosString+'"';
|
||||
}
|
||||
|
||||
MotaActionFunctions.StepString_pre = function(StepString){
|
||||
//StepString='上右3下2左上左2'
|
||||
var route = StepString.replace(/上/g,'U').replace(/下/g,'D').replace(/左/g,'L').replace(/右/g,'R');
|
||||
|
||||
@ -190,7 +190,8 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
},
|
||||
"shops": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "event",
|
||||
"_event": "shop",
|
||||
"_data": "全局商店,是一个数组 \n 每一项是一个Object代表一个全局商店 \n id 为商店的唯一标识符(ID),请确保任何两个商店的id都不相同 \n name 为商店的名称(打开商店后的标题) \n icon 为商店的图标,在icons.js的npcs中定义。如blueShop可代表蓝色商店。 \n textInList 为其在快捷商店栏中显示的名称,如\"3楼金币商店\"等 \n use 为消耗的类型,是金币(money)还是经验(experience)。 \n need 是一个表达式,计算商店所需要用到的数值,可以以times作为参数。 \n text 为商店所说的话。可以用${need}表示需要的数值。\n choices 为商店的各个选项,是一个list,每一项是一个选项,里面text为显示文字,effect为选项的效果,只能用+=,分号分开。"
|
||||
},
|
||||
"levelUp": {
|
||||
|
||||
@ -29,7 +29,7 @@ editor_blockly = function () {
|
||||
{"type": "setValue", "name": "status:hp", "value": "status:hp+\${200*point}"},
|
||||
]},
|
||||
]},'point'),
|
||||
MotaActionFunctions.actionParser.parse({
|
||||
MotaActionFunctions.actionParser.parse([{
|
||||
"id": "moneyShop1",
|
||||
"name": "贪婪之神",
|
||||
"icon": "blueShop",
|
||||
@ -43,7 +43,7 @@ editor_blockly = function () {
|
||||
{"text": "防御+4", "effect": "status:def+=4"},
|
||||
{"text": "魔防+10", "effect": "status:mdef+=10"}
|
||||
]
|
||||
},'shop'),
|
||||
}],'shop'),
|
||||
MotaActionBlocks['afterBattle_m'].xmlText(),
|
||||
MotaActionBlocks['afterGetItem_m'].xmlText(),
|
||||
MotaActionBlocks['afterOpenDoor_m'].xmlText(),
|
||||
@ -102,6 +102,7 @@ editor_blockly = function () {
|
||||
MotaActionBlocks['disableShop_s'].xmlText(),
|
||||
'<label text="特效/声音"></label>',
|
||||
MotaActionBlocks['sleep_s'].xmlText(),
|
||||
MotaActionBlocks['wait_s'].xmlText(),
|
||||
MotaActionBlocks['animate_s'].xmlText(),
|
||||
MotaActionBlocks['setFg_0_s'].xmlText(),
|
||||
MotaActionBlocks['setFg_1_s'].xmlText(),
|
||||
@ -427,6 +428,7 @@ document.getElementById('blocklyDiv').onmousewheel = function(e){
|
||||
'autoText_s': 'EvalString_2',
|
||||
'choices_s': 'EvalString_0',
|
||||
'function_s': 'RawEvalString_0',
|
||||
'shopsub': 'EvalString_3',
|
||||
}
|
||||
var f = b ? textStringDict[b.type] : null;
|
||||
if (f) {
|
||||
|
||||
@ -519,6 +519,10 @@ name是可选的,代表目标行走图的文件名。
|
||||
]
|
||||
```
|
||||
|
||||
### wait:等待用户操作
|
||||
|
||||
使用 `{"type": "wait"}` 可以等待用户进行操作(如点击、回车等)。
|
||||
|
||||
### battle: 强制战斗
|
||||
|
||||
调用battle可强制与某怪物进行战斗(而无需去触碰到它)。
|
||||
|
||||
@ -712,7 +712,7 @@ actions.prototype.longClick = function () {
|
||||
core.drawText();
|
||||
return true;
|
||||
}
|
||||
if (core.status.event.id=='action' && core.status.event.data.type=='text') {
|
||||
if (core.status.event.id=='action' && (core.status.event.data.type=='text' || core.status.event.data.type=='wait')) {
|
||||
core.doAction();
|
||||
return true;
|
||||
}
|
||||
@ -725,7 +725,7 @@ actions.prototype.keyDownCtrl = function () {
|
||||
core.drawText();
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='action' && core.status.event.data.type=='text') {
|
||||
if (core.status.event.id=='action' && (core.status.event.data.type=='text' || core.status.event.data.type=='wait')) {
|
||||
core.doAction();
|
||||
return;
|
||||
}
|
||||
@ -766,7 +766,7 @@ actions.prototype.keyUpConfirmBox = function (keycode) {
|
||||
////// 自定义事件时的点击操作 //////
|
||||
actions.prototype.clickAction = function (x,y) {
|
||||
|
||||
if (core.status.event.data.type=='text') {
|
||||
if (core.status.event.data.type=='text' || core.status.event.data.type=='wait') {
|
||||
// 文字
|
||||
core.doAction();
|
||||
return;
|
||||
@ -808,7 +808,7 @@ actions.prototype.keyDownAction = function (keycode) {
|
||||
|
||||
////// 自定义事件时,放开某个键的操作 //////
|
||||
actions.prototype.keyUpAction = function (keycode) {
|
||||
if (core.status.event.data.type=='text' && (keycode==13 || keycode==32 || keycode==67)) {
|
||||
if ((core.status.event.data.type=='text' || core.status.event.data.type=='wait') && (keycode==13 || keycode==32 || keycode==67)) {
|
||||
core.doAction();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -33,8 +33,8 @@ enemys.prototype.hasSpecial = function (special, test) {
|
||||
|
||||
////// 获得所有特殊属性的名称 //////
|
||||
enemys.prototype.getSpecialText = function (enemyId) {
|
||||
if (enemyId == undefined) return "";
|
||||
var enemy = this.enemys[enemyId];
|
||||
var enemy = core.material.enemys[enemyId];
|
||||
if (!core.isset(enemy)) return [];
|
||||
var special = enemy.special;
|
||||
var text = [];
|
||||
if (this.hasSpecial(special, 1)) text.push("先攻");
|
||||
|
||||
@ -57,8 +57,7 @@ events.prototype.init = function () {
|
||||
callback();
|
||||
},
|
||||
'action': function (data, core, callback) {
|
||||
core.events.doEvents(data.event.data, data.x, data.y);
|
||||
if (core.isset(callback)) callback();
|
||||
core.events.insertAction(data.event.data, data.x, data.y, callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -670,6 +669,10 @@ events.prototype.doAction = function() {
|
||||
}, data.time);
|
||||
}
|
||||
break;
|
||||
case "wait":
|
||||
if (core.status.replay.replaying)
|
||||
core.events.doAction();
|
||||
break;
|
||||
case "revisit": // 立刻重新执行该事件
|
||||
{
|
||||
var block=core.getBlock(x,y); // 重新获得事件
|
||||
|
||||
@ -167,6 +167,8 @@ utils.prototype.formatBigNumber = function (x) {
|
||||
x = parseFloat(x);
|
||||
if (!core.isset(x)) return '???';
|
||||
|
||||
if (x<=999999) return x;
|
||||
|
||||
var all = [
|
||||
{"val": 1e20, "c": "g"},
|
||||
{"val": 1e16, "c": "j"},
|
||||
@ -177,7 +179,7 @@ utils.prototype.formatBigNumber = function (x) {
|
||||
|
||||
for (var i=0;i<all.length;i++) {
|
||||
var one = all[i];
|
||||
if (x>=100*one.val) {
|
||||
if (x>=10*one.val) {
|
||||
var v = x/one.val;
|
||||
return v.toFixed(Math.max(0, Math.floor(4-Math.log10(v+1)))) + one.c;
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@
|
||||
background-color: #000;
|
||||
opacity: 0.85;
|
||||
display: none;
|
||||
z-index: 220;
|
||||
z-index: 260;
|
||||
bottom: 0;
|
||||
margin-bottom: 7%;
|
||||
}
|
||||
|
||||
19
更新说明.txt
19
更新说明.txt
@ -1,4 +1,21 @@
|
||||
HTML5魔塔样板V2.1.1
|
||||
HTML5魔塔样板V2.1.2
|
||||
|
||||
事件坐标可用变量指定
|
||||
全局商店也可以使用图块编辑
|
||||
图片移动事件
|
||||
提供core.random函数提供随机数
|
||||
作弊处理
|
||||
格子有事件则高亮显示
|
||||
状态栏绘制
|
||||
等待用户点击事件
|
||||
事件:设置BGM音量
|
||||
六倍速播放
|
||||
修复标题文字太长导致无法开始游戏的问题
|
||||
新增纯新手简易造塔流程
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
HTML5魔塔样板V2.1.1
|
||||
|
||||
新增事件:改变勇士行走图
|
||||
楼传器落点设置
|
||||
|
||||
Loading…
Reference in New Issue
Block a user