Merge pull request #113 from ckcz123/v2.0

V2.0
This commit is contained in:
Zhang Chen 2018-05-07 00:49:17 +08:00 committed by GitHub
commit 0c045cab26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 922 additions and 361 deletions

View File

@ -63,6 +63,25 @@ HTML5 canvas制作的魔塔样板支持全平台游戏
## 更新说明 ## 更新说明
### 2018.5.6 V2.2
* [x] 事件坐标可用变量指定("loc": ["flag:x", "flag:y"])
* [x] 全局商店也可以使用图块编辑
* [x] 高亮显示有事件的格子
* [x] 对于道具和怪物自动注册该列所有未注册的素材
* [x] 便捷PS工具对于白底图片可自动调整为透明背景
* [x] 事件:等待用户点击(type:wait)
* [x] 事件:图片移动事件(type:moveImage)
* [x] 事件设置BGM音量(type:setVolume)
* [x] 提供core.rand()和core.rand2()两个随机数函数
* [x] 作弊处理(最大有效生命值、匿名则最低成绩上传)
* [x] 自定义状态栏绘制
* [x] 最高六倍速播放
* [x] 播放录像时可以C键查看怪物手册
* [x] 修复标题文字太长导致无法开始游戏的问题
* [x] 新增纯新手简易造塔流程
* [x] 部分效果和性能的优化
### 2018.4.25 V2.1.1 ### 2018.4.25 V2.1.1
* [x] 新增事件:改变勇士行走图 * [x] 新增事件:改变勇士行走图

View File

@ -207,6 +207,7 @@ action
| animateImage_1_s | animateImage_1_s
| showGif_0_s | showGif_0_s
| showGif_1_s | showGif_1_s
| moveImage_0_s
| setFg_0_s | setFg_0_s
| setFg_1_s | setFg_1_s
| setWeather_s | setWeather_s
@ -216,6 +217,7 @@ action
| pauseBgm_s | pauseBgm_s
| resumeBgm_s | resumeBgm_s
| playSound_s | playSound_s
| setVolume_s
| win_s | win_s
| lose_s | lose_s
| if_s | if_s
@ -407,7 +409,7 @@ trigger_s
/* trigger_s /* trigger_s
tooltip : trigger: 立即触发另一个地点的事件 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 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] default : ["0","0"]
colour : this.eventColor colour : this.eventColor
var code = '{"type": "trigger", "loc": ['+PosString_0+','+PosString_1+']},\n'; var code = '{"type": "trigger", "loc": ['+PosString_0+','+PosString_1+']},\n';
return code; return code;
@ -526,7 +528,7 @@ openDoor_s
/* openDoor_s /* openDoor_s
tooltip : openDoor: 开门,楼层可不填表示当前层 tooltip : openDoor: 开门,楼层可不填表示当前层
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=opendoor-%e5%bc%80%e9%97%a8 helpUrl : https://ckcz123.github.io/mota-js/#/event?id=opendoor-%e5%bc%80%e9%97%a8
default : [0,0,""] default : ["","",""]
colour : this.dataColor colour : this.dataColor
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"'); IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var code = '{"type": "openDoor", "loc": ['+PosString_0+','+PosString_1+']'+IdString_0+'},\n'; var code = '{"type": "openDoor", "loc": ['+PosString_0+','+PosString_1+']'+IdString_0+'},\n';
@ -540,7 +542,7 @@ changeFloor_s
/* changeFloor_s /* changeFloor_s
tooltip : changeFloor: 楼层切换,动画时间可不填 tooltip : changeFloor: 楼层切换,动画时间可不填
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=changefloor-%e6%a5%bc%e5%b1%82%e5%88%87%e6%8d%a2 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,null,500] default : ["MT1","0","0",null,500]
colour : this.dataColor colour : this.dataColor
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"'); DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
Int_0 = Int_0 ?(', "time": '+Int_0):''; Int_0 = Int_0 ?(', "time": '+Int_0):'';
@ -555,7 +557,7 @@ changePos_0_s
/* changePos_0_s /* changePos_0_s
tooltip : changePos: 当前位置切换 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 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,null] default : ["","",null]
colour : this.dataColor colour : this.dataColor
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"'); DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
var code = '{"type": "changePos", "loc": ['+PosString_0+','+PosString_1+']'+DirectionEx_List_0+'},\n'; var code = '{"type": "changePos", "loc": ['+PosString_0+','+PosString_1+']'+DirectionEx_List_0+'},\n';
@ -631,7 +633,7 @@ showImage_0_s
/* showImage_0_s /* showImage_0_s
tooltip : showImage显示图片 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 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] default : ["bg.jpg","0","0"]
colour : this.printColor colour : this.printColor
var code = '{"type": "showImage", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+']},\n'; var code = '{"type": "showImage", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+']},\n';
return code; return code;
@ -650,41 +652,41 @@ return code;
*/ */
animateImage_0_s animateImage_0_s
: '图片淡入' EvalString '起点像素位置' 'x' Number 'y' Number '动画时间' Int Newline : '图片淡入' EvalString '起点像素位置' 'x' PosString 'y' PosString '动画时间' Int Newline
; ;
/* animateImage_0_s /* animateImage_0_s
tooltip : animageImage图片淡入 tooltip : animageImage图片淡入
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=animateimage%ef%bc%9a%e5%9b%be%e7%89%87%e6%b7%a1%e5%85%a5%e6%b7%a1%e5%87%b helpUrl : https://ckcz123.github.io/mota-js/#/event?id=animateimage%ef%bc%9a%e5%9b%be%e7%89%87%e6%b7%a1%e5%85%a5%e6%b7%a1%e5%87%b
default : ["bg.jpg",0,0,500] default : ["bg.jpg","0","0",500]
colour : this.printColor colour : this.printColor
var code = '{"type": "animateImage", "action": "show", "name": "'+EvalString_0+'", "loc": ['+Number_0+','+Number_1+'], "time": '+Int_0+'},\n'; var code = '{"type": "animateImage", "action": "show", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "time": '+Int_0+'},\n';
return code; return code;
*/ */
animateImage_1_s animateImage_1_s
: '图片淡出' EvalString '起点像素位置' 'x' Number 'y' Number '动画时间' Int Newline : '图片淡出' EvalString '起点像素位置' 'x' PosString 'y' PosString '动画时间' Int Newline
; ;
/* animateImage_1_s /* animateImage_1_s
tooltip : animageImage图片淡出 tooltip : animageImage图片淡出
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=animateimage%ef%bc%9a%e5%9b%be%e7%89%87%e6%b7%a1%e5%85%a5%e6%b7%a1%e5%87%b helpUrl : https://ckcz123.github.io/mota-js/#/event?id=animateimage%ef%bc%9a%e5%9b%be%e7%89%87%e6%b7%a1%e5%85%a5%e6%b7%a1%e5%87%b
default : ["bg.jpg",0,0,500] default : ["bg.jpg","0","0",500]
colour : this.printColor colour : this.printColor
var code = '{"type": "animateImage", "action": "hide", "name": "'+EvalString_0+'", "loc": ['+Number_0+','+Number_1+'], "time": '+Int_0+'},\n'; var code = '{"type": "animateImage", "action": "hide", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "time": '+Int_0+'},\n';
return code; return code;
*/ */
showGif_0_s showGif_0_s
: '显示动图' EvalString '起点像素位置' 'x' Number 'y' Number Newline : '显示动图' EvalString '起点像素位置' 'x' PosString 'y' PosString Newline
; ;
/* showGif_0_s /* showGif_0_s
tooltip : showGif显示动图 tooltip : showGif显示动图
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=showgif%ef%bc%9a%e6%98%be%e7%a4%ba%e5%8a%a8%e5%9b%be helpUrl : https://ckcz123.github.io/mota-js/#/event?id=showgif%ef%bc%9a%e6%98%be%e7%a4%ba%e5%8a%a8%e5%9b%be
default : ["bg.gif",0,0] default : ["bg.gif","0","0"]
colour : this.printColor colour : this.printColor
var code = '{"type": "showGif", "name": "'+EvalString_0+'", "loc": ['+Number_0+','+Number_1+']},\n'; var code = '{"type": "showGif", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+']},\n';
return code; return code;
*/ */
@ -700,6 +702,20 @@ var code = '{"type": "showGif"},\n';
return code; return code;
*/ */
moveImage_0_s
: '图片移动' EvalString '起点像素位置' 'x' PosString 'y' PosString BGNL
'终点像素位置' 'x' PosString 'y' PosString '移动时间' Int Newline
;
/* moveImage_0_s
tooltip : moveImage图片移动
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=moveImage%ef%bc%9a%e6%98%be%e7%a4%ba%e5%8a%a8%e5%9b%be
default : ["bg.jpg","0","0","0","0",500]
colour : this.printColor
var code = '{"type": "moveImage", "name": "'+EvalString_0+'", "from": ['+PosString_0+','+PosString_1+'], "to": ['+PosString_2+','+PosString_3+'], "time": '+Int_0+'},\n';
return code;
*/
setFg_0_s setFg_0_s
: '更改画面色调' Number ',' Number ',' Number ',' Number '动画时间' Int? Newline : '更改画面色调' Number ',' Number ',' Number ',' Number '动画时间' Int? Newline
; ;
@ -834,6 +850,19 @@ var code = '{"type": "playSound", "name": "'+EvalString_0+'"},\n';
return code; return code;
*/ */
setVolume_s
: '设置音量' Int Newline
;
/* setVolume_s
tooltip : setVolume: 设置音量
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=setVolume-%e8%ae%be%e7%bd%ae%e9%9f%b3%e9%87%8f
default : [90]
colour : this.soundColor
var code = '{"type": "setVolume", "value": '+Int_0+'},\n';
return code;
*/
win_s win_s
: '游戏胜利,结局' ':' EvalString? Newline : '游戏胜利,结局' ':' EvalString? Newline
; ;
@ -1403,6 +1432,11 @@ ActionParser.prototype.parseAction = function() {
this.next]); this.next]);
} }
break; break;
case "moveImage": // 移动图片
this.next = MotaActionBlocks['moveImage_0_s'].xmlText([
data.name, data.from[0], data.from[1], data.to[0], data.to[1], data.time, this.next
]);
break;
case "setFg": // 颜色渐变 case "setFg": // 颜色渐变
if(this.isset(data.color)){ if(this.isset(data.color)){
this.next = MotaActionBlocks['setFg_0_s'].xmlText([ this.next = MotaActionBlocks['setFg_0_s'].xmlText([
@ -1452,6 +1486,10 @@ ActionParser.prototype.parseAction = function() {
this.next = MotaActionBlocks['resumeBgm_s'].xmlText([ this.next = MotaActionBlocks['resumeBgm_s'].xmlText([
this.next]); this.next]);
break break
case "setVolume":
this.next = MotaActionBlocks['setVolume_s'].xmlText([
data.value, this.next]);
break
case "setValue": case "setValue":
this.next = MotaActionBlocks['setValue_s'].xmlText([ this.next = MotaActionBlocks['setValue_s'].xmlText([
MotaActionBlocks['idString_e'].xmlText([data.name]), MotaActionBlocks['idString_e'].xmlText([data.name]),

View File

@ -33,12 +33,6 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_leaf": true, "_leaf": true,
"_type": "textarea", "_type": "textarea",
"_data": "道具在道具栏中显示的描述" "_data": "道具在道具栏中显示的描述"
},
"isEquipment": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "物品是否属于装备(仅在全塔属性的equipment为true时有效)"
} }
} }
}, },

View File

@ -46,7 +46,22 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_leaf": true, "_leaf": true,
"_type": "textarea", "_type": "textarea",
"_data": "难度选择:每个数组的第一个是其在标题界面显示的难度,第二个是在游戏内部传输的字符串,会显示在状态栏,修改此处后需要在project/functions中作相应更改" "_data": "难度选择:每个数组的第一个是其在标题界面显示的难度,第二个是在游戏内部传输的字符串,会显示在状态栏,修改此处后需要在project/functions中作相应更改"
} },
"statusLeftBackground": {
"_leaf": true,
"_type": "textarea",
"_data": "横屏时左侧状态栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图推荐写法\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。"
},
"statusTopBackground": {
"_leaf": true,
"_type": "textarea",
"_data": "竖屏时上方状态栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图推荐写法\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。"
},
"toolsBackground": {
"_leaf": true,
"_type": "textarea",
"_data": "竖屏时下方道具栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图推荐写法\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。"
},
} }
}, },
"firstData": { "firstData": {
@ -340,6 +355,12 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_type": "textarea", "_type": "textarea",
"_data": "仇恨属性中,每杀死一个怪物获得的仇恨值" "_data": "仇恨属性中,每杀死一个怪物获得的仇恨值"
}, },
"maxValidHp": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==null||thiseval>0",
"_data": "最大合法生命值如果此项不为null且用户通关血量超过本值则视为作弊不上传成绩"
},
"animateSpeed": { "animateSpeed": {
"_leaf": true, "_leaf": true,
"_type": "textarea", "_type": "textarea",

View File

@ -20,7 +20,7 @@ editor.prototype.init = function (callback) {
editor.updateMap(); editor.updateMap();
editor.currentFloorId = core.status.floorId; editor.currentFloorId = core.status.floorId;
editor.currentFloorData = core.floors[core.status.floorId]; editor.currentFloorData = core.floors[core.status.floorId];
editor.drawEventBlock();
if (Boolean(callback)) callback(); if (Boolean(callback)) callback();
}); });
} }
@ -193,6 +193,34 @@ editor.prototype.drawMapBg = function (img) {
} }
} }
editor.prototype.drawEventBlock = function () {
var fg=document.getElementById('efg').getContext('2d');
fg.clearRect(0, 0, 416, 416);
for (var i=0;i<13;i++) {
for (var j=0;j<13;j++) {
var color=null;
var loc=i+","+j;
if (core.isset(editor.currentFloorData.events[loc]))
color = '#FF0000';
else if (core.isset(editor.currentFloorData.changeFloor[loc]))
color = '#00FF00';
else if (core.isset(editor.currentFloorData.afterBattle[loc]))
color = '#FFFF00';
else if (core.isset(editor.currentFloorData.afterGetItem[loc]))
color = '#00FFFF';
else if (core.isset(editor.currentFloorData.afterOpenDoor[loc]))
color = '#FF00FF';
else if (core.isset(editor.currentFloorData.cannotMove[loc]))
color = '#0000FF';
if (color!=null) {
fg.fillStyle = color;
fg.fillRect(32*i, 32*j+32-8, 8, 8);
}
}
}
}
editor.prototype.updateMap = function () { editor.prototype.updateMap = function () {
var blocks = main.editor.mapIntoBlocks(editor.map.map(function (v) { var blocks = main.editor.mapIntoBlocks(editor.map.map(function (v) {
return v.map(function (v) { return v.map(function (v) {
@ -340,6 +368,7 @@ editor.prototype.changeFloor = function (floorId, callback) {
editor.currentFloorId = core.status.floorId; editor.currentFloorId = core.status.floorId;
editor.currentFloorData = core.floors[core.status.floorId]; editor.currentFloorData = core.floors[core.status.floorId];
editor_mode.floor(); editor_mode.floor();
editor.drawEventBlock();
if (core.isset(callback)) callback(); if (core.isset(callback)) callback();
}); });
} }

View File

@ -67,6 +67,7 @@ editor_blockly = function () {
MotaActionBlocks['showImage_1_s'].xmlText(), MotaActionBlocks['showImage_1_s'].xmlText(),
MotaActionBlocks['showGif_0_s'].xmlText(), MotaActionBlocks['showGif_0_s'].xmlText(),
MotaActionBlocks['showGif_1_s'].xmlText(), MotaActionBlocks['showGif_1_s'].xmlText(),
MotaActionBlocks['moveImage_0_s'].xmlText(),
MotaActionBlocks['tip_s'].xmlText(), MotaActionBlocks['tip_s'].xmlText(),
MotaActionBlocks['openShop_s'].xmlText(), MotaActionBlocks['openShop_s'].xmlText(),
MotaActionBlocks['win_s'].xmlText(), MotaActionBlocks['win_s'].xmlText(),
@ -111,6 +112,7 @@ editor_blockly = function () {
MotaActionBlocks['pauseBgm_s'].xmlText(), MotaActionBlocks['pauseBgm_s'].xmlText(),
MotaActionBlocks['resumeBgm_s'].xmlText(), MotaActionBlocks['resumeBgm_s'].xmlText(),
MotaActionBlocks['playSound_s'].xmlText(), MotaActionBlocks['playSound_s'].xmlText(),
MotaActionBlocks['setVolume_s'].xmlText(),
'<label text="其他"></label>', '<label text="其他"></label>',
MotaActionBlocks['function_s'].xmlText(), MotaActionBlocks['function_s'].xmlText(),
], ],
@ -268,7 +270,7 @@ document.getElementById('blocklyDiv').onmousewheel = function(e){
var varName = error.varName; var varName = error.varName;
var block = error.block; var block = error.block;
} }
console.log(error); // console.log(error);
} }
} }

View File

@ -144,6 +144,67 @@ editor_file = function (editor, callback) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
editor_file.autoRegister = function (info, callback) {
var iconActions = [];
var mapActions = [];
var templateActions = [];
var image = info.images;
if (image!='items' && image.indexOf('enemy')!=0) {
callback('只有怪物和道具才能自动注册!');
return;
}
var c=image=='items'?'I':'M';
var allIds = [];
editor.ids.forEach(function (v) {
if (v.images==image) {
allIds[v.y]=true;
}
})
var per_height = image.indexOf('48')>=0?48:32;
var idnum=300;
for (var y=0; y<editor.widthsX[image][3]/per_height;y++) {
if (allIds[y]) continue;
while (editor.core.maps.blocksInfo[idnum]) idnum++;
var id = c+idnum;
iconActions.push(["add", "['" + image + "']['" + id + "']", y])
mapActions.push(["add", "['" + idnum + "']", {'cls': image, 'id': id}])
if (image=='items')
templateActions.push(["add", "['items']['" + id + "']", editor_file.comment._data.items_template]);
else
templateActions.push(["add", "['" + id + "']", editor_file.comment._data.enemys_template]);
idnum++;
}
if (iconActions.length==0) {
callback("没有要注册的项!");
return;
}
var templist = [];
var tempcallback = function (err) {
templist.push(err);
if (templist.length == 2) {
if (templist[0] != null || templist[1] != null || templist[2] != null)
callback((templist[0] || '') + '\n' + (templist[1] || '') + '\n' + (templist[2] || ''));
//这里如果一个成功一个失败会出严重bug
else
callback(null);
}
}
saveSetting('icons', iconActions, tempcallback);
saveSetting('maps', mapActions, tempcallback);
if (image=='items')
saveSetting('items', templateActions, tempcallback);
else
saveSetting('enemys', templateActions, tempcallback);
}
editor_file.changeIdAndIdnum = function (id, idnum, info, callback) { editor_file.changeIdAndIdnum = function (id, idnum, info, callback) {
if (!isset(callback)) { if (!isset(callback)) {
printe('未设置callback'); printe('未设置callback');

View File

@ -195,7 +195,8 @@ editor_mode = function (editor) {
printe(objs_.slice(-1)[0]); printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0]) throw(objs_.slice(-1)[0])
} }
;printf('修改成功') ;printf('修改成功');
editor.drawEventBlock();
}); });
break; break;
case 'emenyitem': case 'emenyitem':
@ -222,7 +223,7 @@ editor_mode = function (editor) {
printe(objs_.slice(-1)[0]); printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0]) throw(objs_.slice(-1)[0])
} }
;printf('修改成功') ;printf('修改成功');
}); });
} }
break; break;
@ -233,7 +234,7 @@ editor_mode = function (editor) {
printe(objs_.slice(-1)[0]); printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0]) throw(objs_.slice(-1)[0])
} }
;printf('修改成功') ;printf('修改成功');
}); });
break; break;
case 'tower': case 'tower':
@ -307,11 +308,13 @@ editor_mode = function (editor) {
if (Object.keys(editor.info).length !== 0) editor_mode.info = editor.info;//避免editor.info被清空导致无法获得是物品还是怪物 if (Object.keys(editor.info).length !== 0) editor_mode.info = editor.info;//避免editor.info被清空导致无法获得是物品还是怪物
if (!core.isset(editor_mode.info.id)) { if (!core.isset(editor_mode.info.id)) {
document.getElementById('table_a3f03d4c_55b8_4ef6_b362_b345783acd72').innerHTML = ''; // document.getElementById('table_a3f03d4c_55b8_4ef6_b362_b345783acd72').innerHTML = '';
document.getElementById('newIdIdnum').style.display = ''; document.getElementById('enemyItemTable').style.display = 'none';
document.getElementById('newIdIdnum').style.display = 'block';
return; return;
} }
document.getElementById('newIdIdnum').style.display = 'none'; document.getElementById('newIdIdnum').style.display = 'none';
document.getElementById('enemyItemTable').style.display = 'block';
var objs = []; var objs = [];
if (editor_mode.info.images == 'enemys' || editor_mode.info.images == 'enemy48') { if (editor_mode.info.images == 'enemys' || editor_mode.info.images == 'enemy48') {
@ -404,6 +407,16 @@ editor_mode = function (editor) {
} }
} }
newIdIdnum.children[4].onclick = function () {
editor.file.autoRegister(editor_mode.info, function (err) {
if (err) {
printe(err);
throw(err)
}
printe('该列所有剩余项全部自动注册成功,请F5刷新编辑器');
})
}
var selectFloor = document.getElementById('selectFloor'); var selectFloor = document.getElementById('selectFloor');
editor.file.getFloorFileList(function (floors) { editor.file.getFloorFileList(function (floors) {
var outstr = []; var outstr = [];

View File

@ -1,6 +1,6 @@
# V2.0版本介绍 # V2.0版本介绍
?> 目前版本**v2.1**,上次更新时间:* {docsify-updated} * ?> 目前版本**v2.2**,上次更新时间:* {docsify-updated} *
目前样板已经更新到V2.0版本以上本章将对V2.0的一些内容进行介绍。 目前样板已经更新到V2.0版本以上本章将对V2.0的一些内容进行介绍。

View File

@ -1,6 +1,6 @@
# 附录:API列表 # 附录:API列表
?> 目前版本**v2.1**,上次更新时间:* {docsify-updated} * ?> 目前版本**v2.2**,上次更新时间:* {docsify-updated} *
所有系统支持的API都列在了这里。所有可能被用到的API都在前面用\*标记。 所有系统支持的API都列在了这里。所有可能被用到的API都在前面用\*标记。

View File

@ -1,6 +1,6 @@
# 元件说明 # 元件说明
?> 目前版本**v2.1**,上次更新时间:* {docsify-updated} * ?> 目前版本**v2.2**,上次更新时间:* {docsify-updated} *
在本章中,将对样板里的各个元件进行说明。各个元件主要包括道具、门、怪物、楼梯等等。 在本章中,将对样板里的各个元件进行说明。各个元件主要包括道具、门、怪物、楼梯等等。

View File

@ -1,6 +1,6 @@
# 事件 # 事件
?> 目前版本**v2.1**,上次更新时间:* {docsify-updated} * ?> 目前版本**v2.2**,上次更新时间:* {docsify-updated} *
本章内将对样板所支持的事件进行介绍。 本章内将对样板所支持的事件进行介绍。
@ -373,6 +373,8 @@ value是一个表达式将通过这个表达式计算出的结果赋值给nam
show事件需要用loc指定目标点的坐标可以简单的写[x,y]代表一个点,也可以写个二维数组[[x1,y1],[x2,y2],...]来同时显示多个点。 show事件需要用loc指定目标点的坐标可以简单的写[x,y]代表一个点,也可以写个二维数组[[x1,y1],[x2,y2],...]来同时显示多个点。
从V2.2开始loc也可以用变量来代替例如 `"loc": ["flag:x", "flag:y"]`。下同。
floorId为目标点的楼层如果不是该楼层的事件比如4楼小偷开2楼的门则是必须的如果是当前楼层可以忽略不写。 floorId为目标点的楼层如果不是该楼层的事件比如4楼小偷开2楼的门则是必须的如果是当前楼层可以忽略不写。
time为动画效果时间如果指定了某个大于0的数则会以动画效果慢慢从无到有显示动画时间为该数值如果不指定该选项则无动画直接立刻显示。 time为动画效果时间如果指定了某个大于0的数则会以动画效果慢慢从无到有显示动画时间为该数值如果不指定该选项则无动画直接立刻显示。
@ -704,6 +706,26 @@ loc为动图左上角坐标以像素为单位进行计算。
如果不指定name则清除所有显示的动图。 如果不指定name则清除所有显示的动图。
### moveImage图片移动
我们可以使用 `{"type": "moveImage"}` 来造成图片移动效果。
``` js
"x,y": [ // 实际执行的事件列表
{"type": "moveImage", "name": "bg.jpg", "from": [231,297], "to": [22,333], "time": 500},
]
```
name为图片名。**请确保图片在data.js中的images中被定义过。**
from为起点图片左上角坐标以像素为单位进行计算。
to为终点图片左上角坐标以像素为单位进行计算。
time为总移动的时间。
!> 移动图片只是会在顶层绘制“移动”效果动画结束即消失并不会实际对图片的显示造成影响。请与showImage事件合用。
### setFg: 更改画面色调 ### setFg: 更改画面色调
我们可以使用 `{"type": "setFg"}` 来更改画面色调。 我们可以使用 `{"type": "setFg"}` 来更改画面色调。
@ -842,6 +864,14 @@ move完毕后移动的NPC/怪物一定会消失只不过可以通过immediate
值得注意的是如果是额外添加进文件的音效则需在main.js中this.sounds里加载它。 值得注意的是如果是额外添加进文件的音效则需在main.js中this.sounds里加载它。
### setVolume设置音量
使用setVolume可以设置音量大小。
使用方法: `{"type": "setVolume", "value": 90}`
value为音量大小在0到100之间默认为100。设置后BGM和SE都将使用该音量进行播放。
### win: 获得胜利 ### win: 获得胜利
`{"type": "win", "reason": "xxx"}` 将会直接调用events.js中的win函数并将reason作为结局传入。 `{"type": "win", "reason": "xxx"}` 将会直接调用events.js中的win函数并将reason作为结局传入。

View File

@ -1,6 +1,6 @@
# HTML5 魔塔样板说明文档 # HTML5 魔塔样板说明文档
?> 目前版本**v2.1**,上次更新时间:* {docsify-updated} * ?> 目前版本**v2.2**,上次更新时间:* {docsify-updated} *
众所周知魔塔的趋势是向移动端发展贴吧中也常常能见到“求手机魔塔”的帖子。然而现有的工具中NekoRPG有着比较大的局限性游戏感较差更是完全没法在iOS上运行。而一些APP的魔塔虽然可用但是必须要下载安装对于Android和iOS还必须开发不同的版本非常麻烦。 众所周知魔塔的趋势是向移动端发展贴吧中也常常能见到“求手机魔塔”的帖子。然而现有的工具中NekoRPG有着比较大的局限性游戏感较差更是完全没法在iOS上运行。而一些APP的魔塔虽然可用但是必须要下载安装对于Android和iOS还必须开发不同的版本非常麻烦。

View File

@ -1,6 +1,6 @@
# 个性化 # 个性化
?> 目前版本**v2.1**,上次更新时间:* {docsify-updated} * ?> 目前版本**v2.2**,上次更新时间:* {docsify-updated} *
有时候只靠样板本身可能是不够的。我们需要一些个性化、自定义的素材,道具效果,怪物属性,等等。 有时候只靠样板本身可能是不够的。我们需要一些个性化、自定义的素材,道具效果,怪物属性,等等。

View File

@ -1,6 +1,6 @@
# 快速上手 # 快速上手
?> 目前版本**v2.1**,上次更新时间:* {docsify-updated} * ?> 目前版本**v2.2**,上次更新时间:* {docsify-updated} *
在这一节中,将详细介绍做一部塔的流程。现在,让我们来做一部单层塔! 在这一节中,将详细介绍做一部塔的流程。现在,让我们来做一部单层塔!

View File

@ -86,8 +86,10 @@
<input placeholder="新id唯一标识符"/> <input placeholder="新id唯一标识符"/>
<input placeholder="新idnum1000以内数字"/> <input placeholder="新idnum1000以内数字"/>
<button>save</button> <button>save</button>
<br/>
<button style="margin-top: 10px">自动注册</button>
</div> </div>
<div><!-- enemy and item --> <div id="enemyItemTable"><!-- enemy and item -->
<div class='etable'> <div class='etable'>
<table> <table>
<tbody id='table_a3f03d4c_55b8_4ef6_b362_b345783acd72'> <tbody id='table_a3f03d4c_55b8_4ef6_b362_b345783acd72'>
@ -203,6 +205,7 @@
<canvas class='gameCanvas' id='bg' width='416' height='416'></canvas> <canvas class='gameCanvas' id='bg' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='event' width='416' height='416'></canvas> <canvas class='gameCanvas' id='event' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='event2' width='416' height='416'></canvas> <canvas class='gameCanvas' id='event2' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='efg' width='416' height='416'></canvas>
<canvas class='egameCanvas' id='eui' width='416' height='416' style='z-index:100'></canvas> <canvas class='egameCanvas' id='eui' width='416' height='416' style='z-index:100'></canvas>
</div> </div>
<div class="tools"> <div class="tools">

View File

@ -13,7 +13,7 @@ actions.prototype.init = function () {
////// 按下某个键时 ////// ////// 按下某个键时 //////
actions.prototype.onkeyDown = function (e) { actions.prototype.onkeyDown = function (e) {
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save') return; if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
if (!core.isset(core.status.holdingKeys))core.status.holdingKeys=[]; if (!core.isset(core.status.holdingKeys))core.status.holdingKeys=[];
var isArrow={37:true,38:true,39:true,40:true}[e.keyCode] var isArrow={37:true,38:true,39:true,40:true}[e.keyCode]
if(isArrow && !core.status.lockControl){ if(isArrow && !core.status.lockControl){
@ -31,7 +31,7 @@ actions.prototype.onkeyDown = function (e) {
////// 放开某个键时 ////// ////// 放开某个键时 //////
actions.prototype.onkeyUp = function(e) { actions.prototype.onkeyUp = function(e) {
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save') { if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) {
if (e.keyCode==27) // ESCAPE if (e.keyCode==27) // ESCAPE
core.stopReplay(); core.stopReplay();
else if (e.keyCode==90) // Z else if (e.keyCode==90) // Z
@ -44,6 +44,8 @@ actions.prototype.onkeyUp = function(e) {
core.rewindReplay(); core.rewindReplay();
else if (e.keyCode==83) else if (e.keyCode==83)
core.saveReplay(); core.saveReplay();
else if (e.keyCode==67)
core.bookReplay();
return; return;
} }
@ -64,7 +66,7 @@ actions.prototype.onkeyUp = function(e) {
////// 按住某个键时 ////// ////// 按住某个键时 //////
actions.prototype.pressKey = function (keyCode) { actions.prototype.pressKey = function (keyCode) {
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save') return; if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
if (keyCode === core.status.holdingKeys.slice(-1)[0]) { if (keyCode === core.status.holdingKeys.slice(-1)[0]) {
this.keyDown(keyCode); this.keyDown(keyCode);
window.setTimeout(function(){core.pressKey(keyCode);},30); window.setTimeout(function(){core.pressKey(keyCode);},30);
@ -73,7 +75,7 @@ actions.prototype.pressKey = function (keyCode) {
////// 根据按下键的code来执行一系列操作 ////// ////// 根据按下键的code来执行一系列操作 //////
actions.prototype.keyDown = function(keyCode) { actions.prototype.keyDown = function(keyCode) {
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save') return; if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
if (core.status.lockControl) { if (core.status.lockControl) {
// Ctrl跳过对话 // Ctrl跳过对话
if (keyCode==17) { if (keyCode==17) {
@ -193,7 +195,8 @@ actions.prototype.keyDown = function(keyCode) {
////// 根据放开键的code来执行一系列操作 ////// ////// 根据放开键的code来执行一系列操作 //////
actions.prototype.keyUp = function(keyCode, fromReplay) { actions.prototype.keyUp = function(keyCode, fromReplay) {
if (!fromReplay&&core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save') return; if (!fromReplay&&core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0)
return;
if (core.status.lockControl) { if (core.status.lockControl) {
core.status.holdingKeys = []; core.status.holdingKeys = [];
@ -399,7 +402,7 @@ actions.prototype.keyUp = function(keyCode, fromReplay) {
////// 点击(触摸)事件按下时 ////// ////// 点击(触摸)事件按下时 //////
actions.prototype.ondown = function (x ,y) { actions.prototype.ondown = function (x ,y) {
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save') return; if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
if (!core.status.played || core.status.lockControl) { if (!core.status.played || core.status.lockControl) {
this.onclick(x, y, []); this.onclick(x, y, []);
if (core.timeout.onDownTimeout==null) { if (core.timeout.onDownTimeout==null) {
@ -427,7 +430,7 @@ actions.prototype.ondown = function (x ,y) {
////// 当在触摸屏上滑动时 ////// ////// 当在触摸屏上滑动时 //////
actions.prototype.onmove = function (x ,y) { actions.prototype.onmove = function (x ,y) {
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save') return; if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
// if (core.status.holdingPath==0){return;} // if (core.status.holdingPath==0){return;}
//core.status.mouseOutCheck =1; //core.status.mouseOutCheck =1;
var pos={'x':x,'y':y}; var pos={'x':x,'y':y};
@ -451,7 +454,7 @@ actions.prototype.onmove = function (x ,y) {
////// 当点击(触摸)事件放开时 ////// ////// 当点击(触摸)事件放开时 //////
actions.prototype.onup = function () { actions.prototype.onup = function () {
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save') return; if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
clearTimeout(core.timeout.onDownTimeout); clearTimeout(core.timeout.onDownTimeout);
core.timeout.onDownTimeout = null; core.timeout.onDownTimeout = null;
@ -517,7 +520,7 @@ actions.prototype.getClickLoc = function (x, y) {
////// 具体点击屏幕上(x,y)点时,执行的操作 ////// ////// 具体点击屏幕上(x,y)点时,执行的操作 //////
actions.prototype.onclick = function (x, y, stepPostfix) { actions.prototype.onclick = function (x, y, stepPostfix) {
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save') return; if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
// console.log("Click: (" + x + "," + y + ")"); // console.log("Click: (" + x + "," + y + ")");
stepPostfix=stepPostfix||[]; stepPostfix=stepPostfix||[];
@ -671,7 +674,7 @@ actions.prototype.onclick = function (x, y, stepPostfix) {
////// 滑动鼠标滚轮时的操作 ////// ////// 滑动鼠标滚轮时的操作 //////
actions.prototype.onmousewheel = function (direct) { actions.prototype.onmousewheel = function (direct) {
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save') return; if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
// 向下滚动是 -1 ,向上是 1 // 向下滚动是 -1 ,向上是 1
// 楼层飞行器 // 楼层飞行器
@ -1687,6 +1690,7 @@ actions.prototype.clickSyncSave = function (x,y) {
core.download(core.firstData.name+"_"+core.formatDate2(new Date())+".h5route", JSON.stringify({ core.download(core.firstData.name+"_"+core.formatDate2(new Date())+".h5route", JSON.stringify({
'name': core.firstData.name, 'name': core.firstData.name,
'hard': core.status.hard, 'hard': core.status.hard,
'seed': core.getFlag('seed'),
'route': core.encodeRoute(core.status.route) 'route': core.encodeRoute(core.status.route)
})); }));
break; break;
@ -1919,8 +1923,11 @@ actions.prototype.clickReplay = function (x, y) {
{ {
core.ui.closePanel(); core.ui.closePanel();
var hard=core.status.hard, route=core.clone(core.status.route); var hard=core.status.hard, route=core.clone(core.status.route);
var seed = core.getFlag('seed');
core.resetStatus(core.firstData.hero, hard, core.firstData.floorId, null, core.initStatus.maps); core.resetStatus(core.firstData.hero, hard, core.firstData.floorId, null, core.initStatus.maps);
core.events.setInitData(hard); core.events.setInitData(hard);
core.setFlag('seed', seed);
core.setFlag('rand', seed);
core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() { core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() {
core.startReplay(route); core.startReplay(route);
}, true); }, true);

View File

@ -583,9 +583,14 @@ control.prototype.setHeroMoveInterval = function (direction, x, y, callback) {
'down': {'x': 0, 'y': 1}, 'down': {'x': 0, 'y': 1},
'right': {'x': 1, 'y': 0} 'right': {'x': 1, 'y': 0}
}; };
var toAdd = 1;
if (core.status.replay.speed>3)
toAdd = 2;
core.interval.heroMoveInterval = window.setInterval(function () { core.interval.heroMoveInterval = window.setInterval(function () {
core.status.heroMoving++; core.status.heroMoving+=toAdd;
if (core.status.heroMoving==8) { if (core.status.heroMoving>=8) {
core.setHeroLoc('x', x+scan[direction].x); core.setHeroLoc('x', x+scan[direction].x);
core.setHeroLoc('y', y+scan[direction].y); core.setHeroLoc('y', y+scan[direction].y);
core.moveOneStep(); core.moveOneStep();
@ -595,7 +600,7 @@ control.prototype.setHeroMoveInterval = function (direction, x, y, callback) {
core.status.heroMoving = 0; core.status.heroMoving = 0;
if (core.isset(callback)) callback(); if (core.isset(callback)) callback();
} }
}, 12.5 / core.status.replay.speed); }, 12.5 * toAdd / core.status.replay.speed);
} }
////// 实际每一步的行走过程 ////// ////// 实际每一步的行走过程 //////
@ -1428,8 +1433,9 @@ control.prototype.resumeReplay = function () {
control.prototype.speedUpReplay = function () { control.prototype.speedUpReplay = function () {
if (core.status.event.id=='save') return; if (core.status.event.id=='save') return;
if (!core.status.replay.replaying) return; if (!core.status.replay.replaying) return;
core.status.replay.speed = parseInt(10*core.status.replay.speed + 1)/10; var toAdd = core.status.replay.speed>=3?3:core.status.replay.speed>=2?2:1;
if (core.status.replay.speed>3.0) core.status.replay.speed=3.0; core.status.replay.speed = parseInt(10*core.status.replay.speed + toAdd)/10;
if (core.status.replay.speed>6.0) core.status.replay.speed=6.0;
core.drawTip("x"+core.status.replay.speed+"倍"); core.drawTip("x"+core.status.replay.speed+"倍");
} }
@ -1437,7 +1443,8 @@ control.prototype.speedUpReplay = function () {
control.prototype.speedDownReplay = function () { control.prototype.speedDownReplay = function () {
if (core.status.event.id=='save') return; if (core.status.event.id=='save') return;
if (!core.status.replay.replaying) return; if (!core.status.replay.replaying) return;
core.status.replay.speed = parseInt(10*core.status.replay.speed - 1)/10; var toAdd = core.status.replay.speed>3?3:core.status.replay.speed>2?2:1;
core.status.replay.speed = parseInt(10*core.status.replay.speed - toAdd)/10;
if (core.status.replay.speed<0.3) core.status.replay.speed=0.3; if (core.status.replay.speed<0.3) core.status.replay.speed=0.3;
core.drawTip("x"+core.status.replay.speed+"倍"); core.drawTip("x"+core.status.replay.speed+"倍");
} }
@ -1512,6 +1519,23 @@ control.prototype.saveReplay = function () {
core.ui.drawSLPanel(10*page+offset); core.ui.drawSLPanel(10*page+offset);
} }
////// 回放时查看怪物手册 //////
control.prototype.bookReplay = function () {
if (!core.status.replay.replaying) return;
if (!core.status.replay.pausing) {
core.drawTip("请先暂停录像");
return;
}
if (core.status.replay.animate || core.isset(core.status.event.id)) {
core.drawTip("请等待当前事件的处理结束");
return;
}
core.lockControl();
core.status.event.id='book';
core.useItem('book');
}
////// 回放 ////// ////// 回放 //////
control.prototype.replay = function () { control.prototype.replay = function () {
@ -1541,8 +1565,10 @@ control.prototype.replay = function () {
if (action=='up' || action=='down' || action=='left' || action=='right') { if (action=='up' || action=='down' || action=='left' || action=='right') {
core.moveHero(action, function () { core.moveHero(action, function () {
setTimeout(function() {
core.replay(); core.replay();
}); });
});
return; return;
} }
else if (action.indexOf("item:")==0) { else if (action.indexOf("item:")==0) {
@ -1819,8 +1845,11 @@ control.prototype.doSL = function (id, type) {
// core.drawTip("存档版本不匹配"); // core.drawTip("存档版本不匹配");
if (confirm("存档版本不匹配!\n你想回放此存档的录像吗")) { if (confirm("存档版本不匹配!\n你想回放此存档的录像吗")) {
core.dom.startPanel.style.display = 'none'; core.dom.startPanel.style.display = 'none';
var seed = data.hero.flags.seed;
core.resetStatus(core.firstData.hero, data.hard, core.firstData.floorId, null, core.initStatus.maps); core.resetStatus(core.firstData.hero, data.hard, core.firstData.floorId, null, core.initStatus.maps);
core.events.setInitData(data.hard); core.events.setInitData(data.hard);
core.setFlag('seed', seed);
core.setFlag('rand', seed);
core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() { core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() {
core.startReplay(core.decodeRoute(data.route)); core.startReplay(core.decodeRoute(data.route));
}, true); }, true);
@ -1852,7 +1881,7 @@ control.prototype.doSL = function (id, type) {
return; return;
} }
var route = core.subarray(core.status.route, core.decodeRoute(data.route)); var route = core.subarray(core.status.route, core.decodeRoute(data.route));
if (!core.isset(route)) { if (!core.isset(route) || data.hero.flags.seed!=core.getFlag('seed')) {
core.drawTip("无法从此存档回放录像"); core.drawTip("无法从此存档回放录像");
return; return;
} }
@ -2101,6 +2130,7 @@ control.prototype.playBgm = function (bgm) {
} }
// 播放当前BGM // 播放当前BGM
core.musicStatus.playingBgm = bgm; core.musicStatus.playingBgm = bgm;
core.material.bgms[bgm].volume = core.musicStatus.volume;
core.material.bgms[bgm].play(); core.material.bgms[bgm].play();
core.musicStatus.isPlaying = true; core.musicStatus.isPlaying = true;
@ -2168,7 +2198,7 @@ control.prototype.playSound = function (sound) {
if (core.musicStatus.audioContext != null) { if (core.musicStatus.audioContext != null) {
var source = core.musicStatus.audioContext.createBufferSource(); var source = core.musicStatus.audioContext.createBufferSource();
source.buffer = core.material.sounds[sound]; source.buffer = core.material.sounds[sound];
source.connect(core.musicStatus.audioContext.destination); source.connect(core.musicStatus.gainNode);
try { try {
source.start(0); source.start(0);
} }
@ -2181,11 +2211,12 @@ control.prototype.playSound = function (sound) {
} }
} }
else { else {
core.material.sounds[sound].volume = core.musicStatus.volume;
core.material.sounds[sound].play(); core.material.sounds[sound].play();
} }
} }
catch (eee) { catch (eee) {
console.log("无法播放SE "+bgm); console.log("无法播放SE "+sound);
console.log(eee); console.log(eee);
} }
} }
@ -2253,18 +2284,14 @@ control.prototype.updateStatusBar = function () {
core.statusBar.image.fly.style.opacity = 1; core.statusBar.image.fly.style.opacity = 1;
core.statusBar.image.toolbox.src = core.statusBar.icons.rewind.src; core.statusBar.image.toolbox.src = core.statusBar.icons.rewind.src;
core.statusBar.image.toolbox.style.opacity = 1;
core.statusBar.image.shop.style.opacity = 0; core.statusBar.image.shop.src = core.statusBar.icons.book.src;
core.statusBar.image.save.src = core.statusBar.icons.speedDown.src; core.statusBar.image.save.src = core.statusBar.icons.speedDown.src;
core.statusBar.image.save.style.opacity = 1;
core.statusBar.image.load.src = core.statusBar.icons.speedUp.src; core.statusBar.image.load.src = core.statusBar.icons.speedUp.src;
core.statusBar.image.load.style.opacity = 1;
core.statusBar.image.settings.src = core.statusBar.icons.save.src; core.statusBar.image.settings.src = core.statusBar.icons.save.src;
core.statusBar.image.settings.style.opacity = 1;
} }
else { else {
@ -2275,18 +2302,14 @@ control.prototype.updateStatusBar = function () {
core.statusBar.image.fly.style.opacity = core.hasItem('fly')?1:0.3; core.statusBar.image.fly.style.opacity = core.hasItem('fly')?1:0.3;
core.statusBar.image.toolbox.src = core.statusBar.icons.toolbox.src; core.statusBar.image.toolbox.src = core.statusBar.icons.toolbox.src;
core.statusBar.image.toolbox.style.opacity = 1;
core.statusBar.image.shop.style.opacity = 1; core.statusBar.image.shop.src = core.statusBar.icons.shop.src;
core.statusBar.image.save.src = core.statusBar.icons.save.src; core.statusBar.image.save.src = core.statusBar.icons.save.src;
core.statusBar.image.save.style.opacity = 1;
core.statusBar.image.load.src = core.statusBar.icons.load.src; core.statusBar.image.load.src = core.statusBar.icons.load.src;
core.statusBar.image.load.style.opacity = 1;
core.statusBar.image.settings.src = core.statusBar.icons.settings.src; core.statusBar.image.settings.src = core.statusBar.icons.settings.src;
core.statusBar.image.settings.style.opacity = 1;
} }
core.updateFg(); core.updateFg();
@ -2321,7 +2344,7 @@ control.prototype.resize = function(clientWidth, clientHeight) {
statusWidth, statusHeight, statusMaxWidth,statusLabelsLH, statusWidth, statusHeight, statusMaxWidth,statusLabelsLH,
toolBarWidth, toolBarHeight, toolBarTop, toolBarBorder, toolBarWidth, toolBarHeight, toolBarTop, toolBarBorder,
toolsWidth, toolsHeight,toolsMargin,toolsPMaxwidth, toolsWidth, toolsHeight,toolsMargin,toolsPMaxwidth,
fontSize, toolbarFontSize, margin; fontSize, toolbarFontSize, margin, statusBackground, toolsBackground;
var count = core.dom.statusBar.children.length; var count = core.dom.statusBar.children.length;
if (!core.flags.enableFloor) count--; if (!core.flags.enableFloor) count--;
@ -2380,12 +2403,14 @@ control.prototype.resize = function(clientWidth, clientHeight) {
statusHeight = scale*BASE_LINEHEIGHT * .8; statusHeight = scale*BASE_LINEHEIGHT * .8;
statusLabelsLH = .8 * BASE_LINEHEIGHT *scale; statusLabelsLH = .8 * BASE_LINEHEIGHT *scale;
statusMaxWidth = scale * DEFAULT_BAR_WIDTH * .95; statusMaxWidth = scale * DEFAULT_BAR_WIDTH * .95;
statusBackground = main.statusTopBackground;
toolBarHeight = tempBotBarH; toolBarHeight = tempBotBarH;
toolBarTop = statusBarHeight + canvasWidth; toolBarTop = statusBarHeight + canvasWidth;
toolBarBorder = '3px #fff solid'; toolBarBorder = '3px #fff solid';
toolsHeight = scale * BASE_LINEHEIGHT; toolsHeight = scale * BASE_LINEHEIGHT;
toolsPMaxwidth = scale * DEFAULT_BAR_WIDTH * .4; toolsPMaxwidth = scale * DEFAULT_BAR_WIDTH * .4;
toolsBackground = main.toolsBackground;
borderRight = '3px #fff solid'; borderRight = '3px #fff solid';
margin = scale * SPACE * 2; margin = scale * SPACE * 2;
@ -2400,15 +2425,17 @@ control.prototype.resize = function(clientWidth, clientHeight) {
canvasTop = 0; canvasTop = 0;
// canvasLeft = DEFAULT_BAR_WIDTH * scale; // canvasLeft = DEFAULT_BAR_WIDTH * scale;
toolBarWidth = statusBarWidth = DEFAULT_BAR_WIDTH * scale; toolBarWidth = statusBarWidth = DEFAULT_BAR_WIDTH * scale;
statusBarHeight = scale * statusLineHeight * count + SPACE * 2; //一共有9行加上两个padding空隙 statusBarHeight = gameGroupHeight - SPACE;
statusBarBorder = '3px #fff solid'; statusBarBorder = '3px #fff solid';
statusBackground = main.statusLeftBackground;
statusHeight = scale*statusLineHeight * .8; statusHeight = scale*statusLineHeight * .8;
statusLabelsLH = .8 * statusLineHeight *scale; statusLabelsLH = .8 * statusLineHeight *scale;
toolBarHeight = canvasWidth - statusBarHeight;
toolBarTop = scale*statusLineHeight * count + SPACE * 2; toolBarTop = scale*statusLineHeight * count + SPACE * 2;
toolBarHeight = canvasWidth - toolBarTop;
toolBarBorder = '3px #fff solid'; toolBarBorder = '3px #fff solid';
toolsHeight = scale * BASE_LINEHEIGHT; toolsHeight = scale * BASE_LINEHEIGHT;
toolsBackground = 'transparent';
fontSize = statusLineFontSize * scale; fontSize = statusLineFontSize * scale;
toolbarFontSize = DEFAULT_FONT_SIZE * scale; toolbarFontSize = DEFAULT_FONT_SIZE * scale;
borderRight = ''; borderRight = '';
@ -2431,12 +2458,15 @@ control.prototype.resize = function(clientWidth, clientHeight) {
// canvasLeft = DEFAULT_BAR_WIDTH; // canvasLeft = DEFAULT_BAR_WIDTH;
toolBarWidth = statusBarWidth = DEFAULT_BAR_WIDTH; toolBarWidth = statusBarWidth = DEFAULT_BAR_WIDTH;
statusBarHeight = statusLineHeight * count + SPACE * 2; //一共有9行 // statusBarHeight = statusLineHeight * count + SPACE * 2; //一共有9行
statusBackground = main.statusLeftBackground;
statusBarHeight = gameGroupHeight - SPACE;
statusHeight = statusLineHeight * .8; statusHeight = statusLineHeight * .8;
statusLabelsLH = .8 * statusLineHeight; statusLabelsLH = .8 * statusLineHeight;
toolBarHeight = DEFAULT_CANVAS_WIDTH - statusBarHeight;
toolBarTop = statusLineHeight * count + SPACE * 2; toolBarTop = statusLineHeight * count + SPACE * 2;
toolBarHeight = DEFAULT_CANVAS_WIDTH - toolBarTop;
toolsBackground = 'transparent';
toolsHeight = BASE_LINEHEIGHT; toolsHeight = BASE_LINEHEIGHT;
borderRight = ''; borderRight = '';
@ -2517,7 +2547,8 @@ control.prototype.resize = function(clientWidth, clientHeight) {
borderTop: statusBarBorder, borderTop: statusBarBorder,
borderLeft: statusBarBorder, borderLeft: statusBarBorder,
borderRight: borderRight, borderRight: borderRight,
fontSize: fontSize + unit fontSize: fontSize + unit,
background: statusBackground,
} }
}, },
{ {
@ -2547,7 +2578,8 @@ control.prototype.resize = function(clientWidth, clientHeight) {
borderBottom: toolBarBorder, borderBottom: toolBarBorder,
borderLeft: toolBarBorder, borderLeft: toolBarBorder,
borderRight: borderRight, borderRight: borderRight,
fontSize: toolbarFontSize + unit fontSize: toolbarFontSize + unit,
background: toolsBackground,
} }
}, },
{ {

View File

@ -48,6 +48,8 @@ function core() {
'soundStatus': true, // 是否播放SE 'soundStatus': true, // 是否播放SE
'playingBgm': null, // 正在播放的BGM 'playingBgm': null, // 正在播放的BGM
'isPlaying': false, 'isPlaying': false,
'gainNode': null,
'volume': 1.0, // 音量
} }
this.platform = { this.platform = {
'isOnline': true, // 是否http 'isOnline': true, // 是否http
@ -187,6 +189,8 @@ core.prototype.init = function (coreData, callback) {
window.AudioContext = window.AudioContext || window.webkitAudioContext || window.mozAudioContext || window.msAudioContext; window.AudioContext = window.AudioContext || window.webkitAudioContext || window.mozAudioContext || window.msAudioContext;
try { try {
core.musicStatus.audioContext = new window.AudioContext(); core.musicStatus.audioContext = new window.AudioContext();
core.musicStatus.gainNode = core.musicStatus.audioContext.createGain();
core.musicStatus.gainNode.connect(core.musicStatus.audioContext.destination);
} catch (e) { } catch (e) {
console.log("该浏览器不支持AudioContext"); console.log("该浏览器不支持AudioContext");
core.musicStatus.audioContext = null; core.musicStatus.audioContext = null;
@ -928,6 +932,10 @@ core.prototype.saveReplay = function () {
core.control.saveReplay(); core.control.saveReplay();
} }
core.prototype.bookReplay = function () {
core.control.bookReplay();
}
////// 回放 ////// ////// 回放 //////
core.prototype.replay = function () { core.prototype.replay = function () {
core.control.replay(); core.control.replay();
@ -1077,6 +1085,16 @@ core.prototype.subarray = function (a, b) {
return core.utils.subarray(a, b); return core.utils.subarray(a, b);
} }
////// 生成随机数seed方法 //////
core.prototype.rand = function (num) {
return core.utils.rand(num);
}
////// 生成随机数(录像方法) //////
core.prototype.rand2 = function (num) {
return core.utils.rand2(num);
}
////// 读取一个本地文件内容 ////// ////// 读取一个本地文件内容 //////
core.prototype.readFile = function (success, error, readType) { core.prototype.readFile = function (success, error, readType) {
core.utils.readFile(success, error, readType); core.utils.readFile(success, error, readType);

View File

@ -88,16 +88,19 @@ events.prototype.startGame = function (hard) {
core.flags.battleAnimate = true; core.flags.battleAnimate = true;
core.setLocalStorage('battleAnimate', true); core.setLocalStorage('battleAnimate', true);
core.startGame(hard); core.startGame(hard);
core.utils.__init_seed();
core.events.setInitData(hard); core.events.setInitData(hard);
}, function () { }, function () {
core.flags.battleAnimate = false; core.flags.battleAnimate = false;
core.setLocalStorage('battleAnimate', false); core.setLocalStorage('battleAnimate', false);
core.startGame(hard); core.startGame(hard);
core.utils.__init_seed();
core.events.setInitData(hard); core.events.setInitData(hard);
}); });
} }
else { else {
core.startGame(hard); core.startGame(hard);
core.utils.__init_seed();
core.events.setInitData(hard); core.events.setInitData(hard);
} }
}); });
@ -141,6 +144,7 @@ events.prototype.gameOver = function (ending, fromReplay) {
'name': core.firstData.name, 'name': core.firstData.name,
'version': core.firstData.version, 'version': core.firstData.version,
'hard': core.status.hard, 'hard': core.status.hard,
'seed': core.getFlag('seed'),
'route': core.encodeRoute(core.status.route) 'route': core.encodeRoute(core.status.route)
} }
core.download(core.firstData.name+"_"+core.formatDate2(new Date())+".h5route", JSON.stringify(obj)); core.download(core.firstData.name+"_"+core.formatDate2(new Date())+".h5route", JSON.stringify(obj));
@ -162,7 +166,8 @@ events.prototype.gameOver = function (ending, fromReplay) {
} }
var doUpload = function(username) { var doUpload = function(username) {
if (username==null) username=""; var hp = core.status.hero.hp;
if (username==undefined) hp = 1;
// upload // upload
var formData = new FormData(); var formData = new FormData();
@ -171,18 +176,22 @@ events.prototype.gameOver = function (ending, fromReplay) {
formData.append('version', core.firstData.version); formData.append('version', core.firstData.version);
formData.append('platform', core.platform.isPC?"PC":core.platform.isAndroid?"Android":core.platform.isIOS?"iOS":""); formData.append('platform', core.platform.isPC?"PC":core.platform.isAndroid?"Android":core.platform.isIOS?"iOS":"");
formData.append('hard', core.status.hard); formData.append('hard', core.status.hard);
formData.append('username', username); formData.append('username', username||"");
formData.append('ending', ending); formData.append('ending', ending);
formData.append('lv', core.status.hero.lv); formData.append('lv', core.status.hero.lv);
formData.append('hp', core.status.hero.hp); formData.append('hp', hp);
formData.append('atk', core.status.hero.atk); formData.append('atk', core.status.hero.atk);
formData.append('def', core.status.hero.def); formData.append('def', core.status.hero.def);
formData.append('mdef', core.status.hero.mdef); formData.append('mdef', core.status.hero.mdef);
formData.append('money', core.status.hero.money); formData.append('money', core.status.hero.money);
formData.append('experience', core.status.hero.experience); formData.append('experience', core.status.hero.experience);
formData.append('steps', core.status.hero.steps); formData.append('steps', core.status.hero.steps);
formData.append('seed', core.getFlag('seed'));
formData.append('route', core.encodeRoute(core.status.route)); formData.append('route', core.encodeRoute(core.status.route));
if (main.isCompetition)
core.http("POST", "/games/competition/upload.php", formData);
else
core.http("POST", "/games/upload.php", formData); core.http("POST", "/games/upload.php", formData);
setTimeout(function() { setTimeout(function() {
@ -191,9 +200,17 @@ events.prototype.gameOver = function (ending, fromReplay) {
} }
core.ui.drawConfirmBox("你想记录你的ID和成绩吗", function () { core.ui.drawConfirmBox("你想记录你的ID和成绩吗", function () {
doUpload(prompt("请输入你的ID")); if (main.isCompetition) {
}, function () {
doUpload(""); doUpload("");
}
else {
doUpload(prompt("请输入你的ID"));
}
}, function () {
if (main.isCompetition)
confirmDownload();
else
doUpload(undefined);
}) })
return; return;
@ -204,12 +221,21 @@ events.prototype.gameOver = function (ending, fromReplay) {
core.restart(); core.restart();
}); });
} }
else {
if (core.isset(core.values.maxValidHp) && core.status.hero.hp>core.values.maxValidHp) {
core.drawText("作弊可耻!", function () {
core.restart();
});
}
else { else {
confirmUpload(); confirmUpload();
} }
} }
}
////// 转换楼层结束的事件 ////// ////// 转换楼层结束的事件 //////
events.prototype.afterChangeFloor = function (floorId) { events.prototype.afterChangeFloor = function (floorId) {
if (main.mode!='play') return; if (main.mode!='play') return;
@ -310,8 +336,9 @@ events.prototype.doAction = function() {
core.events.doAction(); core.events.doAction();
break; break;
case "show": // 显示 case "show": // 显示
if (typeof data.loc[0] == 'number' && typeof data.loc[1] == 'number') if ((typeof data.loc[0] == 'number' || typeof data.loc[0] == 'string')
data.loc = [data.loc]; && (typeof data.loc[1] == 'number' || typeof data.loc[1] == 'string'))
data.loc = [[core.calValue(data.loc[0]), core.calValue(data.loc[1])]];
if (core.isset(data.time) && data.time>0 && (!core.isset(data.floorId) || data.floorId==core.status.floorId)) { if (core.isset(data.time) && data.time>0 && (!core.isset(data.floorId) || data.floorId==core.status.floorId)) {
core.animateBlock(data.loc,'show', data.time, function () { core.animateBlock(data.loc,'show', data.time, function () {
data.loc.forEach(function (t) { data.loc.forEach(function (t) {
@ -330,8 +357,9 @@ events.prototype.doAction = function() {
case "hide": // 消失 case "hide": // 消失
if (!core.isset(data.loc)) if (!core.isset(data.loc))
data.loc = [x,y]; data.loc = [x,y];
if (typeof data.loc[0] == 'number' && typeof data.loc[1] == 'number') if ((typeof data.loc[0] == 'number' || typeof data.loc[0] == 'string')
data.loc = [data.loc]; && (typeof data.loc[1] == 'number' || typeof data.loc[1] == 'string'))
data.loc = [[core.calValue(data.loc[0]), core.calValue(data.loc[1])]];
data.loc.forEach(function (t) { data.loc.forEach(function (t) {
core.removeBlock(t[0],t[1],data.floorId); core.removeBlock(t[0],t[1],data.floorId);
}) })
@ -345,8 +373,8 @@ events.prototype.doAction = function() {
case "setBlock": // 设置某图块 case "setBlock": // 设置某图块
{ {
if (core.isset(data.loc)) { if (core.isset(data.loc)) {
x=data.loc[0]; x=core.calValue(data.loc[0]);
y=data.loc[1]; y=core.calValue(data.loc[1]);
} }
var floorId = data.floorId||core.status.floorId; var floorId = data.floorId||core.status.floorId;
var originBlock=core.getBlock(x,y,floorId,false); var originBlock=core.getBlock(x,y,floorId,false);
@ -378,8 +406,8 @@ events.prototype.doAction = function() {
y=core.getHeroLoc('y'); y=core.getHeroLoc('y');
} }
else if (data.loc instanceof Array) { else if (data.loc instanceof Array) {
x=data.loc[0]; x=core.calValue(data.loc[0]);
y=data.loc[1]; y=core.calValue(data.loc[1]);
} }
} }
core.drawAnimate(data.name, x, y, function () { core.drawAnimate(data.name, x, y, function () {
@ -388,8 +416,8 @@ events.prototype.doAction = function() {
break; break;
case "move": // 移动事件 case "move": // 移动事件
if (core.isset(data.loc)) { if (core.isset(data.loc)) {
x=data.loc[0]; x=core.calValue(data.loc[0]);
y=data.loc[1]; y=core.calValue(data.loc[1]);
} }
core.moveBlock(x,y,data.steps,data.time,data.immediateHide,function() { core.moveBlock(x,y,data.steps,data.time,data.immediateHide,function() {
core.events.doAction(); core.events.doAction();
@ -402,7 +430,7 @@ events.prototype.doAction = function() {
break; break;
case "changeFloor": // 楼层转换 case "changeFloor": // 楼层转换
{ {
var heroLoc = {"x": data.loc[0], "y": data.loc[1]}; var heroLoc = {"x": core.calValue(data.loc[0]), "y": core.calValue(data.loc[1])};
if (core.isset(data.direction)) heroLoc.direction=data.direction; if (core.isset(data.direction)) heroLoc.direction=data.direction;
core.changeFloor(data.floorId||core.status.floorId, null, heroLoc, data.time, function() { core.changeFloor(data.floorId||core.status.floorId, null, heroLoc, data.time, function() {
core.lockControl(); core.lockControl();
@ -413,8 +441,8 @@ events.prototype.doAction = function() {
case "changePos": // 直接更换勇士位置,不切换楼层 case "changePos": // 直接更换勇士位置,不切换楼层
core.clearMap('hero', 0, 0, 416, 416); core.clearMap('hero', 0, 0, 416, 416);
if (core.isset(data.loc)) { if (core.isset(data.loc)) {
core.setHeroLoc('x', data.loc[0]); core.setHeroLoc('x', core.calValue(data.loc[0]));
core.setHeroLoc('y', data.loc[1]); core.setHeroLoc('y', core.calValue(data.loc[1]));
} }
if (core.isset(data.direction)) core.setHeroLoc('direction', data.direction); if (core.isset(data.direction)) core.setHeroLoc('direction', data.direction);
core.drawHero(); core.drawHero();
@ -422,7 +450,8 @@ events.prototype.doAction = function() {
break; break;
case "showImage": // 显示图片 case "showImage": // 显示图片
if (core.isset(data.loc) && core.isset(core.material.images.images[data.name])) { if (core.isset(data.loc) && core.isset(core.material.images.images[data.name])) {
core.canvas.animate.drawImage(core.material.images.images[data.name], data.loc[0], data.loc[1]); core.canvas.animate.drawImage(core.material.images.images[data.name],
core.calValue(data.loc[0]), core.calValue(data.loc[1]));
} }
else core.clearMap('animate', 0, 0, 416, 416); else core.clearMap('animate', 0, 0, 416, 416);
this.doAction(); this.doAction();
@ -447,8 +476,8 @@ events.prototype.doAction = function() {
var gif = new Image(); var gif = new Image();
gif.src = core.material.images.images[data.name].src; gif.src = core.material.images.images[data.name].src;
gif.style.position = 'absolute'; gif.style.position = 'absolute';
gif.style.left = (data.loc[0]*core.domStyle.scale)+"px"; gif.style.left = (core.calValue(data.loc[0])*core.domStyle.scale)+"px";
gif.style.top = (data.loc[1]*core.domStyle.scale)+"px"; gif.style.top = (core.calValue(data.loc[1])*core.domStyle.scale)+"px";
core.dom.gif2.appendChild(gif); core.dom.gif2.appendChild(gif);
} }
else { else {
@ -456,6 +485,21 @@ events.prototype.doAction = function() {
} }
this.doAction(); this.doAction();
break; break;
case "moveImage": // 图片移动
if (core.status.replay.replaying) { // 正在播放录像
this.doAction();
}
else {
if (core.isset(data.from) && core.isset(data.to) && core.isset(core.material.images.images[data.name])) {
core.events.moveImage(core.material.images.images[data.name], data.from, data.to, data.time, function() {
core.events.doAction();
});
}
else {
this.doAction();
}
}
break;
case "setFg": // 颜色渐变 case "setFg": // 颜色渐变
core.setFg(data.color, data.time, function() { core.setFg(data.color, data.time, function() {
core.events.doAction(); core.events.doAction();
@ -468,7 +512,7 @@ events.prototype.doAction = function() {
case "openDoor": // 开一个门,包括暗墙 case "openDoor": // 开一个门,包括暗墙
{ {
var floorId=data.floorId || core.status.floorId; var floorId=data.floorId || core.status.floorId;
var block=core.getBlock(data.loc[0], data.loc[1], floorId); var block=core.getBlock(core.calValue(data.loc[0]), core.calValue(data.loc[1]), floorId);
if (block!=null) { if (block!=null) {
if (floorId==core.status.floorId) if (floorId==core.status.floorId)
core.openDoor(block.block.event.id, block.block.x, block.block.y, false, function() { core.openDoor(block.block.event.id, block.block.x, block.block.y, false, function() {
@ -503,7 +547,7 @@ events.prototype.doAction = function() {
break; break;
case "trigger": // 触发另一个事件;当前事件会被立刻结束。需要另一个地点的事件是有效的 case "trigger": // 触发另一个事件;当前事件会被立刻结束。需要另一个地点的事件是有效的
{ {
var toX=data.loc[0], toY=data.loc[1]; var toX=core.calValue(data.loc[0]), toY=core.calValue(data.loc[1]);
var block=core.getBlock(toX, toY); var block=core.getBlock(toX, toY);
if (block!=null) { if (block!=null) {
block = block.block; block = block.block;
@ -534,6 +578,17 @@ events.prototype.doAction = function() {
core.resumeBgm(); core.resumeBgm();
this.doAction(); this.doAction();
break break
case "setVolume":
data.value = parseInt(data.value||0);
if (data.value>100) data.value=100;
data.value = data.value / 100;
core.musicStatus.volume = data.value;
if (core.isset(core.musicStatus.playingBgm)) {
core.material.bgms[core.musicStatus.playingBgm].volume = data.value;
}
core.musicStatus.gainNode.gain.value = data.value;
this.doAction();
break;
case "setValue": case "setValue":
try { try {
var value=core.calValue(data.value); var value=core.calValue(data.value);
@ -591,9 +646,9 @@ events.prototype.doAction = function() {
core.drawTip("录像文件出错"); core.drawTip("录像文件出错");
return; return;
} }
} }
else { else {
core.interval.onDownInterval = 'tmp';
value = prompt(core.replaceText(data.text)); value = prompt(core.replaceText(data.text));
} }
value = Math.abs(parseInt(value)||0); value = Math.abs(parseInt(value)||0);
@ -1031,7 +1086,7 @@ events.prototype.animateImage = function (type, image, loc, time, callback) {
if (type == 'hide') opacityVal = 1; if (type == 'hide') opacityVal = 1;
core.setOpacity('data', opacityVal); core.setOpacity('data', opacityVal);
core.canvas.data.drawImage(image, loc[0], loc[1]); core.canvas.data.drawImage(image, core.calValue(loc[0]), core.calValue(loc[1]));
core.status.replay.animate=true; core.status.replay.animate=true;
var animate = setInterval(function () { var animate = setInterval(function () {
if (type=='show') opacityVal += 0.1; if (type=='show') opacityVal += 0.1;
@ -1044,7 +1099,38 @@ events.prototype.animateImage = function (type, image, loc, time, callback) {
core.status.replay.animate=false; core.status.replay.animate=false;
if (core.isset(callback)) callback(); if (core.isset(callback)) callback();
} }
}, time / 10 / core.status.replay.speed); }, time / 10);
}
////// 移动图片 //////
events.prototype.moveImage = function (image, from, to, time, callback) {
time = time || 1000;
clearInterval(core.interval.tipAnimate);
core.setAlpha('data', 1);
core.setOpacity('data', 1);
core.status.replay.animate=true;
var fromX = core.calValue(from[0]), fromY = core.calValue(from[1]),
toX = core.calValue(to[0]), toY = core.calValue(to[1]);
var step = 0;
var drawImage = function () {
core.clearMap('data', 0, 0, 416, 416);
var nowX = parseInt(fromX + (toX-fromX)*step/64);
var nowY = parseInt(fromY + (toY-fromY)*step/64);
core.canvas.data.drawImage(image, nowX, nowY);
}
drawImage();
var animate = setInterval(function () {
step++;
drawImage();
if (step>=64) {
clearInterval(animate);
core.clearMap('data', 0, 0, 416, 416);
core.status.replay.animate=false;
if (core.isset(callback)) callback();
}
}, time / 64);
} }
////// 打开一个全局商店 ////// ////// 打开一个全局商店 //////

View File

@ -32,9 +32,11 @@ items.prototype.getItemEffect = function(itemId, itemNum) {
////// “即捡即用类”道具的文字提示 ////// ////// “即捡即用类”道具的文字提示 //////
items.prototype.getItemEffectTip = function(itemId) { items.prototype.getItemEffectTip = function(itemId) {
var itemCls = core.material.items[itemId].cls;
// 消耗品
if (itemCls === 'items') {
var ratio = parseInt(core.floors[core.status.floorId].item_ratio) || 1; var ratio = parseInt(core.floors[core.status.floorId].item_ratio) || 1;
if (itemId in this.itemEffectTip && (!this.items[itemId].isEquipment || !core.flags.equipment)) { if (itemId in this.itemEffectTip) return eval(this.itemEffectTip[itemId])||"";
return eval(this.itemEffectTip[itemId]);
} }
return ""; return "";
} }

View File

@ -1513,7 +1513,7 @@ ui.prototype.drawToolbox = function(index) {
if (core.isset(selectId)) { if (core.isset(selectId)) {
var item=core.material.items[selectId]; var item=core.material.items[selectId];
core.fillText('ui', item.name, 10, 32, '#FFD700', "bold 20px Verdana") core.fillText('ui', item.name, 10, 32, '#FFD700', "bold 20px Verdana")
core.fillText('ui', item.text, 10, 62, '#FFFFFF', '17px Verdana'); core.fillText('ui', item.text||"该道具暂无描述。", 10, 62, '#FFFFFF', '17px Verdana');
core.fillText('ui', '<继续点击该道具即可进行使用>', 10, 89, '#CCCCCC', '14px Verdana'); core.fillText('ui', '<继续点击该道具即可进行使用>', 10, 89, '#CCCCCC', '14px Verdana');
} }

View File

@ -20,6 +20,12 @@ utils.prototype.replaceText = function (text) {
////// 计算表达式的值 ////// ////// 计算表达式的值 //////
utils.prototype.calValue = function (value) { utils.prototype.calValue = function (value) {
if (typeof value == 'number') {
return value;
}
if (value instanceof Function) {
return value();
}
value=value.replace(/status:([\w\d_]+)/g, "core.getStatus('$1')"); value=value.replace(/status:([\w\d_]+)/g, "core.getStatus('$1')");
value=value.replace(/item:([\w\d_]+)/g, "core.itemCount('$1')"); value=value.replace(/item:([\w\d_]+)/g, "core.itemCount('$1')");
value=value.replace(/flag:([\w\d_]+)/g, "core.getFlag('$1', 0)"); value=value.replace(/flag:([\w\d_]+)/g, "core.getFlag('$1', 0)");
@ -235,8 +241,10 @@ utils.prototype.encodeRoute = function (route) {
ans+='N'; ans+='N';
else if (t.indexOf('move:')==0) else if (t.indexOf('move:')==0)
ans+="M"+t.substring(5); ans+="M"+t.substring(5);
else if (t=='key:') else if (t.indexOf('key:')==0)
ans+='K'+t.substring(4); ans+='K'+t.substring(4);
else if (t.indexOf('random:')==0)
ans+='X'+t.substring(7);
} }
}); });
if (cnt>0) { if (cnt>0) {
@ -289,6 +297,7 @@ utils.prototype.decodeRoute = function (route) {
case "N": ans.push("no"); break; case "N": ans.push("no"); break;
case "M": ++index; ans.push("move:"+nxt+":"+getNumber()); break; case "M": ++index; ans.push("move:"+nxt+":"+getNumber()); break;
case "K": ans.push("key:"+nxt); break; case "K": ans.push("key:"+nxt); break;
case "X": ans.push("random:"+nxt); break;
} }
} }
return ans; return ans;
@ -313,6 +322,54 @@ utils.prototype.subarray = function (a, b) {
return na; return na;
} }
utils.prototype.__init_seed = function () {
var rand = new Date().getTime()%34834795 + 3534;
rand = this.__next_rand(rand);
rand = this.__next_rand(rand);
rand = this.__next_rand(rand);
core.setFlag('seed', rand);
core.setFlag('rand', rand);
}
utils.prototype.__next_rand = function (_rand) {
_rand=(_rand%127773)*16807-~~(_rand/127773)*2836;
_rand+=_rand<0?2147483647:0;
return _rand;
}
utils.prototype.rand = function (num) {
var rand = core.getFlag('rand');
rand = this.__next_rand(rand);
core.setFlag('rand', rand);
var ans = rand/2147483647;
if (core.isset(num) && num>0)
return Math.floor(ans*num);
return ans;
}
////// 生成随机数(录像方法) //////
utils.prototype.rand2 = function (num) {
num = num||2147483648;
var value;
if (core.status.replay.replaying) {
var action = core.status.replay.toReplay.shift();
if (action.indexOf("random:")==0 ) {
value=parseInt(action.substring(7));
}
else {
core.stopReplay();
core.drawTip("录像文件出错");
return;
}
}
else {
value = Math.floor(Math.random()*num);
}
core.status.route.push("random:"+value);
return value;
}
////// 读取一个本地文件内容 ////// ////// 读取一个本地文件内容 //////
utils.prototype.readFile = function (success, error, readType) { utils.prototype.readFile = function (success, error, readType) {

12
main.js
View File

@ -2,7 +2,7 @@ function main() {
//------------------------ 用户修改内容 ------------------------// //------------------------ 用户修改内容 ------------------------//
this.version = "2.1.1"; // 游戏版本号如果更改了游戏内容建议修改此version以免造成缓存问题。 this.version = "2.2"; // 游戏版本号如果更改了游戏内容建议修改此version以免造成缓存问题。
this.useCompress = false; // 是否使用压缩文件 this.useCompress = false; // 是否使用压缩文件
// 当你即将发布你的塔时请使用“JS代码压缩工具”将所有js代码进行压缩然后将这里的useCompress改为true。 // 当你即将发布你的塔时请使用“JS代码压缩工具”将所有js代码进行压缩然后将这里的useCompress改为true。
@ -12,6 +12,8 @@ function main() {
this.bgmRemote = false; // 是否采用远程BGM this.bgmRemote = false; // 是否采用远程BGM
this.bgmRemoteRoot = "https://gitee.com/ckcz123/h5music/raw/master/"; // 远程BGM的根目录 this.bgmRemoteRoot = "https://gitee.com/ckcz123/h5music/raw/master/"; // 远程BGM的根目录
this.isCompetition = false; // 是否是比赛模式
//------------------------ 用户修改内容 END ------------------------// //------------------------ 用户修改内容 END ------------------------//
this.dom = { this.dom = {
@ -403,6 +405,12 @@ main.statusBar.image.toolbox.onclick = function () {
////// 点击状态栏中的快捷商店时 ////// ////// 点击状态栏中的快捷商店时 //////
main.statusBar.image.shop.onclick = function () { main.statusBar.image.shop.onclick = function () {
if (core.isset(core.status.replay) && core.status.replay.replaying) {
core.bookReplay();
return;
}
if (main.core.isPlaying()) if (main.core.isPlaying())
main.core.openQuickShop(true); main.core.openQuickShop(true);
} }
@ -481,6 +489,8 @@ main.dom.replayGame.onclick = function () {
core.dom.startPanel.style.display = 'none'; core.dom.startPanel.style.display = 'none';
core.resetStatus(core.firstData.hero, obj.hard, core.firstData.floorId, null, core.initStatus.maps); core.resetStatus(core.firstData.hero, obj.hard, core.firstData.floorId, null, core.initStatus.maps);
core.events.setInitData(obj.hard); core.events.setInitData(obj.hard);
core.setFlag('seed', obj.seed);
core.setFlag('rand', obj.seed);
core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() { core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() {
core.startReplay(core.decodeRoute(obj.route)); core.startReplay(core.decodeRoute(obj.route));
}, true); }, true);

View File

@ -19,11 +19,14 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"startBackground" : "bg.jpg", "startBackground" : "bg.jpg",
"startLogoStyle" : "color: black", "startLogoStyle" : "color: black",
"levelChoose" : [["简单","Easy"],["普通","Normal"],["困难","Hard"],["噩梦","Hell"]], "levelChoose" : [["简单","Easy"],["普通","Normal"],["困难","Hard"],["噩梦","Hell"]],
"statusLeftBackground": "url(project/images/ground.png) repeat",
"statusTopBackground": "url(project/images/ground.png) repeat",
"toolsBackground": "url(project/images/ground.png) repeat"
}, },
"firstData" : { "firstData" : {
"title": "魔塔样板", "title": "魔塔样板",
"name": "template", "name": "template",
"version": "Ver 2.1.1", "version": "Ver 2.2",
"floorId": "sample0", "floorId": "sample0",
"hero": { "hero": {
"name": "阳光", "name": "阳光",
@ -129,6 +132,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
'counterAttack': 0.1, 'counterAttack': 0.1,
'purify': 3, 'purify': 3,
'hatred': 2, 'hatred': 2,
'maxValidHp': null,
'animateSpeed': 300, 'animateSpeed': 300,
}, },

View File

@ -14,19 +14,17 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (core.flags.bombFourDirections) if (core.flags.bombFourDirections)
core.material.items.bomb.text = "可以炸掉勇士四周的怪物"; core.material.items.bomb.text = "可以炸掉勇士四周的怪物";
if (core.flags.equipment) { if (core.flags.equipment) {
core.material.items.sword1 = {'cls': 'constants', 'name': '铁剑', 'text': '一把很普通的铁剑'}; core.material.items.sword1.cls = 'constants';
core.material.items.sword2 = {'cls': 'constants', 'name': '银剑', 'text': '一把很普通的银剑'}; core.material.items.sword2.cls = 'constants';
core.material.items.sword3 = {'cls': 'constants', 'name': '骑士剑', 'text': '一把很普通的骑士剑'}; core.material.items.sword3.cls = 'constants';
core.material.items.sword4 = {'cls': 'constants', 'name': '圣剑', 'text': '一把很普通的圣剑'}; core.material.items.sword4.cls = 'constants';
core.material.items.sword5 = {'cls': 'constants', 'name': '神圣剑', 'text': '一把很普通的神圣剑'}; core.material.items.sword5.cls = 'constants';
core.material.items.shield1 = {'cls': 'constants', 'name': '铁盾', 'text': '一个很普通的铁盾'}; core.material.items.shield1.cls = 'constants';
core.material.items.shield2 = {'cls': 'constants', 'name': '银盾', 'text': '一个很普通的银盾'}; core.material.items.shield2.cls = 'constants';
core.material.items.shield3 = {'cls': 'constants', 'name': '骑士盾', 'text': '一个很普通的骑士盾'}; core.material.items.shield3.cls = 'constants';
core.material.items.shield4 = {'cls': 'constants', 'name': '圣盾', 'text': '一个很普通的圣盾'}; core.material.items.shield4.cls = 'constants';
core.material.items.shield5 = {'cls': 'constants', 'name': '神圣盾', 'text': '一个很普通的神圣盾'}; core.material.items.shield5.cls = 'constants';
} }
}, },
////// 不同难度分别设置初始属性 ////// ////// 不同难度分别设置初始属性 //////
"setInitData":function (hard) { "setInitData":function (hard) {
@ -343,59 +341,38 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
console.log("插件函数执行测试"); console.log("插件函数执行测试");
} }
var _useEquipment = function (itemId, name, type) {
if (itemId.indexOf(name)==0) {
var now=core.getFlag(name, name+"0");
if (typeof core.values[now] == 'number') {
core.status.hero[type] -= core.values[now];
}
else {
core.status.hero.atk -= core.values[now].atk || 0;
core.status.hero.def -= core.values[now].def || 0;
core.status.hero.mdef -= core.values[now].mdef || 0;
}
if (typeof core.values[itemId] == 'number') {
core.status.hero[type] += core.values[itemId];
}
else {
core.status.hero.atk += core.values[itemId].atk || 0;
core.status.hero.def += core.values[itemId].def || 0;
core.status.hero.mdef += core.values[itemId].mdef || 0;
}
core.setItem(now, 1);
core.setItem(itemId, 0);
core.setFlag(name, itemId);
core.drawTip("已装备"+core.material.items[itemId].name);
}
}
this.useEquipment = function (itemId) { // 使用装备 this.useEquipment = function (itemId) { // 使用装备
if (itemId.indexOf("sword")==0) { _useEquipment(itemId, "sword", "atk");
var now=core.getFlag('sword', 'sword0'); // 当前装备剑的ID _useEquipment(itemId, "shield", "def");
if (typeof core.values[now] == 'number') {
core.status.hero.atk -= core.values[now];
}
else {
core.status.hero.atk -= core.values[now].atk || 0;
core.status.hero.def -= core.values[now].def || 0;
core.status.hero.mdef -= core.values[now].mdef || 0;
}
if (typeof core.values[itemId] == 'number') {
core.status.hero.atk += core.values[itemId];
}
else {
core.status.hero.atk += core.values[itemId].atk || 0;
core.status.hero.def += core.values[itemId].def || 0;
core.status.hero.mdef += core.values[itemId].mdef || 0;
}
core.setItem(now, 1);
core.setItem(itemId, 0);
core.setFlag('sword', itemId);
core.drawTip("已装备"+core.material.items[itemId].name);
}
if (itemId.indexOf("shield")==0) {
var now=core.getFlag('shield', 'shield0');
if (typeof core.values[now] == 'number') {
core.status.hero.def -= core.values[now];
}
else {
core.status.hero.atk -= core.values[now].atk || 0;
core.status.hero.def -= core.values[now].def || 0;
core.status.hero.mdef -= core.values[now].mdef || 0;
}
if (typeof core.values[itemId] == 'number') {
core.status.hero.def += core.values[itemId];
}
else {
core.status.hero.atk += core.values[itemId].atk || 0;
core.status.hero.def += core.values[itemId].def || 0;
core.status.hero.mdef += core.values[itemId].mdef || 0;
}
core.setItem(now, 1);
core.setItem(itemId, 0);
core.setFlag('shield', itemId);
core.drawTip("已装备"+core.material.items[itemId].name);
}
} }
// 可以在任何地方如afterXXX或自定义脚本事件调用函数方法为 core.plugin.xxx(); // 可以在任何地方如afterXXX或自定义脚本事件调用函数方法为 core.plugin.xxx();

View File

@ -1,73 +1,234 @@
items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
{ {
"items": { "items": {
// 钥匙 "yellowKey": {
'yellowKey': {'cls': 'keys', 'name': '黄钥匙'}, "cls": "keys",
'blueKey': {'cls': 'keys', 'name': '蓝钥匙'}, "name": "黄钥匙"
'redKey': {'cls': 'keys', 'name': '红钥匙'}, },
"blueKey": {
// 宝石、血瓶 "cls": "keys",
'redJewel': {'cls': 'items', 'name': '红宝石'}, "name": "蓝钥匙"
'blueJewel': {'cls': 'items', 'name': '蓝宝石'}, },
'greenJewel': {'cls': 'items', 'name': '绿宝石'}, "redKey": {
'yellowJewel': {'cls': 'items', 'name': '黄宝石'}, "cls": "keys",
'redPotion': {'cls': 'items', 'name': '红血瓶'}, "name": "红钥匙"
'bluePotion': {'cls': 'items', 'name': '蓝血瓶'}, },
'yellowPotion': {'cls': 'items', 'name': '黄血瓶'}, "redJewel": {
'greenPotion': {'cls': 'items', 'name': '绿血瓶'}, "cls": "items",
'sword1': {'cls': 'items', 'name': '铁剑', 'isEquipment': true}, "name": "红宝石"
'sword2': {'cls': 'items', 'name': '银剑', 'isEquipment': true}, },
'sword3': {'cls': 'items', 'name': '骑士剑', 'isEquipment': true}, "blueJewel": {
'sword4': {'cls': 'items', 'name': '圣剑', 'isEquipment': true}, "cls": "items",
'sword5': {'cls': 'items', 'name': '神圣剑', 'isEquipment': true}, "name": "蓝宝石"
'shield1': {'cls': 'items', 'name': '铁盾', 'isEquipment': true}, },
'shield2': {'cls': 'items', 'name': '银盾', 'isEquipment': true}, "greenJewel": {
'shield3': {'cls': 'items', 'name': '骑士盾', 'isEquipment': true}, "cls": "items",
'shield4': {'cls': 'items', 'name': '圣盾', 'isEquipment': true}, "name": "绿宝石"
'shield5': {'cls': 'items', 'name': '神圣盾', 'isEquipment': true}, },
'superPotion': {'cls': 'items', 'name': '圣水'}, "yellowJewel": {
'moneyPocket': {'cls': 'items', 'name': '金钱袋'}, "cls": "items",
"name": "黄宝石"
// 物品 },
'sword0': {'cls': 'constants', 'name': '折断的剑', 'text': '没有任何作用的剑,相当于脱掉装备。'}, "redPotion": {
'shield0': {'cls': 'constants', 'name': '残破的盾', 'text': '没有任何作用的盾,相当于脱掉装备。'}, "cls": "items",
'book': {'cls': 'constants', 'name': '怪物手册', 'text': '可以查看当前楼层各怪物属性'}, "name": "红血瓶"
'fly': {'cls': 'constants', 'name': '楼层传送器', 'text': '可以自由往来去过的楼层'}, },
'coin': {'cls': 'constants', 'name': '幸运金币', 'text': '持有时打败怪物可得双倍金币'}, "bluePotion": {
'snow': {'cls': 'constants', 'name': '冰冻徽章', 'text': '可以将四周的熔岩变成平地'}, "cls": "items",
'cross': {'cls': 'constants', 'name': '十字架', 'text': '持有后无视怪物的无敌属性'}, "name": "蓝血瓶"
'knife': {'cls': 'constants', 'name': '屠龙匕首', 'text': '该道具尚未被定义'}, },
'shoes': {'cls': 'constants', 'name': '绿鞋', 'text': '持有时无视负面地形'}, "yellowPotion": {
"cls": "items",
// 道具 "name": "黄血瓶"
'bigKey': {'cls': 'tools', 'name': '大黄门钥匙', 'text': '可以开启当前层所有黄门'}, },
'greenKey': {'cls': 'tools', 'name': '绿钥匙', 'text': '可以打开一扇绿门'}, "greenPotion": {
'steelKey': {'cls': 'tools', 'name': '铁门钥匙', 'text': '可以打开一扇铁门'}, "cls": "items",
'pickaxe': {'cls': 'tools', 'name': '破墙镐', 'text': '可以破坏勇士面前的墙'}, "name": "绿血瓶"
'icePickaxe': {'cls': 'tools', 'name': '破冰镐', 'text': '可以破坏勇士面前的一堵冰墙'}, },
'bomb': {'cls': 'tools', 'name': '炸弹', 'text': '可以炸掉勇士面前的怪物'}, "sword1": {
'centerFly': {'cls': 'tools', 'name': '中心对称飞行器', 'text': '可以飞向当前楼层中心对称的位置'}, "cls": "items",
'upFly': {'cls': 'tools', 'name': '上楼器', 'text': '可以飞往楼上的相同位置'}, "name": "铁剑",
'downFly': {'cls': 'tools', 'name': '下楼器', 'text': '可以飞往楼下的相同位置'}, "text": "一把很普通的铁剑"
'earthquake': {'cls': 'tools', 'name': '地震卷轴', 'text': '可以破坏当前层的所有墙'}, },
'poisonWine': {'cls': 'tools', 'name': '解毒药水', 'text': '可以解除中毒状态'}, "sword2": {
'weakWine': {'cls': 'tools', 'name': '解衰药水', 'text': '可以解除衰弱状态'}, "cls": "items",
'curseWine': {'cls': 'tools', 'name': '解咒药水', 'text': '可以解除诅咒状态'}, "name": "银剑",
'superWine': {'cls': 'tools', 'name': '万能药水', 'text': '可以解除所有不良状态'}, "text": "一把很普通的银剑"
'hammer': {'cls': 'tools', 'name': '圣锤', 'text': '可以炸掉勇士面前的怪物'} },
"sword3": {
"cls": "items",
"name": "骑士剑",
"text": "一把很普通的骑士剑"
},
"sword4": {
"cls": "items",
"name": "圣剑",
"text": "一把很普通的圣剑"
},
"sword5": {
"cls": "items",
"name": "神圣剑",
"text": "一把很普通的神圣剑"
},
"shield1": {
"cls": "items",
"name": "铁盾",
"text": "一个很普通的铁盾"
},
"shield2": {
"cls": "items",
"name": "银盾",
"text": "一个很普通的银盾"
},
"shield3": {
"cls": "items",
"name": "骑士盾",
"text": "一个很普通的骑士盾"
},
"shield4": {
"cls": "items",
"name": "圣盾",
"text": "一个很普通的圣盾"
},
"shield5": {
"cls": "items",
"name": "神圣盾",
"text": "一个很普通的神圣盾"
},
"superPotion": {
"cls": "items",
"name": "圣水"
},
"moneyPocket": {
"cls": "items",
"name": "金钱袋"
},
"sword0": {
"cls": "constants",
"name": "折断的剑",
"text": "没有任何作用的剑,相当于脱掉装备。"
},
"shield0": {
"cls": "constants",
"name": "残破的盾",
"text": "没有任何作用的盾,相当于脱掉装备。"
},
"book": {
"cls": "constants",
"name": "怪物手册",
"text": "可以查看当前楼层各怪物属性"
},
"fly": {
"cls": "constants",
"name": "楼层传送器",
"text": "可以自由往来去过的楼层"
},
"coin": {
"cls": "constants",
"name": "幸运金币",
"text": "持有时打败怪物可得双倍金币"
},
"snow": {
"cls": "constants",
"name": "冰冻徽章",
"text": "可以将四周的熔岩变成平地"
},
"cross": {
"cls": "constants",
"name": "十字架",
"text": "持有后无视怪物的无敌属性"
},
"knife": {
"cls": "constants",
"name": "屠龙匕首",
"text": "该道具尚未被定义"
},
"shoes": {
"cls": "constants",
"name": "绿鞋",
"text": "持有时无视负面地形"
},
"bigKey": {
"cls": "tools",
"name": "大黄门钥匙",
"text": "可以开启当前层所有黄门"
},
"greenKey": {
"cls": "tools",
"name": "绿钥匙",
"text": "可以打开一扇绿门"
},
"steelKey": {
"cls": "tools",
"name": "铁门钥匙",
"text": "可以打开一扇铁门"
},
"pickaxe": {
"cls": "tools",
"name": "破墙镐",
"text": "可以破坏勇士面前的墙"
},
"icePickaxe": {
"cls": "tools",
"name": "破冰镐",
"text": "可以破坏勇士面前的一堵冰墙"
},
"bomb": {
"cls": "tools",
"name": "炸弹",
"text": "可以炸掉勇士面前的怪物"
},
"centerFly": {
"cls": "tools",
"name": "中心对称飞行器",
"text": "可以飞向当前楼层中心对称的位置"
},
"upFly": {
"cls": "tools",
"name": "上楼器",
"text": "可以飞往楼上的相同位置"
},
"downFly": {
"cls": "tools",
"name": "下楼器",
"text": "可以飞往楼下的相同位置"
},
"earthquake": {
"cls": "tools",
"name": "地震卷轴",
"text": "可以破坏当前层的所有墙"
},
"poisonWine": {
"cls": "tools",
"name": "解毒药水",
"text": "可以解除中毒状态"
},
"weakWine": {
"cls": "tools",
"name": "解衰药水",
"text": "可以解除衰弱状态"
},
"curseWine": {
"cls": "tools",
"name": "解咒药水",
"text": "可以解除诅咒状态"
},
"superWine": {
"cls": "tools",
"name": "万能药水",
"text": "可以解除所有不良状态"
},
"hammer": {
"cls": "tools",
"name": "圣锤",
"text": "可以炸掉勇士面前的怪物"
}
}, },
"itemEffect": { "itemEffect": {
"redJewel": "core.status.hero.atk += core.values.redJewel * ratio", "redJewel": "core.status.hero.atk += core.values.redJewel * ratio",
"blueJewel": "core.status.hero.def += core.values.blueJewel * ratio", "blueJewel": "core.status.hero.def += core.values.blueJewel * ratio",
"greenJewel": "core.status.hero.mdef += core.values.greenJewel * ratio", "greenJewel": "core.status.hero.mdef += core.values.greenJewel * ratio",
"yellowJewel": "core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;", "yellowJewel": "core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;",
// 黄宝石属性:需自己定义
"redPotion": "core.status.hero.hp += core.values.redPotion * ratio", "redPotion": "core.status.hero.hp += core.values.redPotion * ratio",
"bluePotion": "core.status.hero.hp += core.values.bluePotion * ratio", "bluePotion": "core.status.hero.hp += core.values.bluePotion * ratio",
"yellowPotion": "core.status.hero.hp += core.values.yellowPotion * ratio", "yellowPotion": "core.status.hero.hp += core.values.yellowPotion * ratio",
@ -82,14 +243,10 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"shield3": "core.status.hero.def += core.values.shield3", "shield3": "core.status.hero.def += core.values.shield3",
"shield4": "core.status.hero.def += core.values.shield4", "shield4": "core.status.hero.def += core.values.shield4",
"shield5": "core.status.hero.def += core.values.shield5", "shield5": "core.status.hero.def += core.values.shield5",
"bigKey": "core.status.hero.items.keys.yellowKey++;core.status.hero.items.keys.blueKey++;core.status.hero.items.keys.redKey++;", "bigKey": "core.status.hero.items.keys.yellowKey++;core.status.hero.items.keys.blueKey++;core.status.hero.items.keys.redKey++;",
// 只有是钥匙盒才会执行这一步
"superPotion": "core.status.hero.hp *= 2", "superPotion": "core.status.hero.hp *= 2",
"moneyPocket":"core.status.hero.money += core.values.moneyPocket", "moneyPocket": "core.status.hero.money += core.values.moneyPocket"
}, },
"itemEffectTip": { "itemEffectTip": {
"redJewel": "',攻击+'+core.values.redJewel * ratio", "redJewel": "',攻击+'+core.values.redJewel * ratio",
"blueJewel": "',防御+'+core.values.blueJewel * ratio", "blueJewel": "',防御+'+core.values.blueJewel * ratio",
@ -111,9 +268,8 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"shield5": "',防御+'+core.values.shield5", "shield5": "',防御+'+core.values.shield5",
"bigKey": "',全钥匙+1'", "bigKey": "',全钥匙+1'",
"superPotion": "',生命值翻倍'", "superPotion": "',生命值翻倍'",
"moneyPocket":"',金币+'+core.values.moneyPocket", "moneyPocket": "',金币+'+core.values.moneyPocket"
}, },
"useItemEffect": { "useItemEffect": {
"book": "core.ui.drawBook(0);", "book": "core.ui.drawBook(0);",
"fly": "core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));", "fly": "core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));",
@ -142,9 +298,8 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"shield2": "core.plugin.useEquipment(itemId)", "shield2": "core.plugin.useEquipment(itemId)",
"shield3": "core.plugin.useEquipment(itemId)", "shield3": "core.plugin.useEquipment(itemId)",
"shield4": "core.plugin.useEquipment(itemId)", "shield4": "core.plugin.useEquipment(itemId)",
"shield5": "core.plugin.useEquipment(itemId)", "shield5": "core.plugin.useEquipment(itemId)"
}, },
"canUseItemEffect": { "canUseItemEffect": {
"book": "true", "book": "true",
"fly": "core.status.hero.flyRange.indexOf(core.status.floorId)>=0", "fly": "core.status.hero.flyRange.indexOf(core.status.floorId)>=0",
@ -174,7 +329,6 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"shield3": "true", "shield3": "true",
"shield4": "true", "shield4": "true",
"shiled5": "true", "shiled5": "true",
"shield5": "true"
} }
} }

View File

@ -170,7 +170,7 @@
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
background: url(project/images/ground.png) repeat; background: url(project/images/ground.png) repeat;
z-index: 160; z-index: 150;
display: none; display: none;
} }
#statusBar .status{ #statusBar .status{
@ -199,7 +199,7 @@
#toolBar { #toolBar {
position: absolute; position: absolute;
background: url(project/images/ground.png) repeat; background: url(project/images/ground.png) repeat;
z-index: 150; z-index: 160;
box-sizing: border-box; box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;

Binary file not shown.

View File

@ -1,17 +1,21 @@
HTML5魔塔样板V2.1.2 HTML5魔塔样板V2.2
事件坐标可用变量指定 事件坐标可用变量指定("loc": ["flag:x", "flag:y"])
全局商店也可以使用图块编辑 全局商店也可以使用图块编辑
图片移动事件 高亮显示有事件的格子
提供core.random函数提供随机数 对于道具和怪物自动注册该列所有未注册的素材
作弊处理 便捷PS工具对于白底图片可自动调整为透明背景
格子有事件则高亮显示 事件:等待用户点击(type:wait)
状态栏绘制 事件:图片移动事件(type:moveImage)
等待用户点击事件 事件设置BGM音量(type:setVolume)
事件设置BGM音量 提供core.rand()和core.rand2()两个随机数函数
六倍速播放 作弊处理(最大有效生命值、匿名则最低成绩上传)
自定义状态栏绘制
最高六倍速播放
播放录像时可以C键查看怪物手册
修复标题文字太长导致无法开始游戏的问题 修复标题文字太长导致无法开始游戏的问题
新增纯新手简易造塔流程 新增纯新手简易造塔流程
部分效果和性能的优化
----------------------------------------------------------------------- -----------------------------------------------------------------------