diff --git a/README.md b/README.md index d95e7847..474a83cc 100644 --- a/README.md +++ b/README.md @@ -278,8 +278,27 @@ HTML5 canvas制作的魔塔样板,支持全平台游戏! ## 联系我们 -本塔由 [`ckcz123`](https://github.com/ckcz123) (百度ID `艾之葵`)编写。 +本样板主要由 [`ckcz123`](https://github.com/ckcz123) (百度ID `艾之葵`)编写。 HTML5魔塔交流群群号: `539113091` 如有其它意见或建议,也可以通过发[issues](https://github.com/ckcz123/mota-js/issues)、或邮件至[ckcz123@126.com](mailto:ckcz123@126.com)联系我。 + +## 贡献者 + +感谢对本样板做出贡献的人员: + +@ckcz123 本样板的的主要编写者。样板的运行时的核心代码,所有常用小工具,以及安卓APP等,都是其所写。 + +@Vinlic 第一个HTML5魔塔[纪元魔塔前传](https://tieba.baidu.com/p/4545234500)([游戏地址](http://vinlic.gitee.io/mota/),[开发记录贴](https://tieba.baidu.com/p/4397526540),[源代码](https://gitee.com/Vinlic/Mota))的编写者。 +该塔的[第三版内核](https://tieba.baidu.com/p/4738973089)是现在HTML5魔塔样板的前身,现在样板的很多核心逻辑控制,以及UI界面等相关代码都是继承于该塔。 + +@zhaouv V2.0的推动者,可视化地图编辑器和事件编辑器的制作者,手机端魔塔制作界面的编写者。现在我们能在V2.0用到方便快捷的可视化地图编辑器,以及通过拖动图块来编写事件,能在手机端造塔等,都需要归功于zhaouv的贡献。 + +@iEcho V2.0的推动者,可视化地图编辑器的制作者,游戏界面自适应匹配的编写者。和zhaouv一起推动和开发了V2.0的制作。 + +@wadxm iOS平台的APP(因为苹果政策无法上架)和启动服务mac版的开发者。我们现在能在mac上制作魔塔得归功于他。 + +@fux4 打通了RM和H5之间的障壁(从而使RM动画导出器和怪物数据导出器成为可能),同时也是部分新功能(如跳跃、跟随、画面震动)等的编写者。 + +以及[百度贴吧魔塔吧](https://tieba.baidu.com/f?kw=%E9%AD%94%E5%A1%94)和H5魔塔交流群`539113091`内的诸位魔塔爱好者们对本样板的大力支持! diff --git a/_server/css/editor_mobile.css b/_server/css/editor_mobile.css index 5beeecdb..5eb06c2f 100644 --- a/_server/css/editor_mobile.css +++ b/_server/css/editor_mobile.css @@ -290,13 +290,15 @@ table.col td { padding: 0; border-bottom-width: 0px; border-top-width: 0px; + border-left-width: 0.117307vw; + border-right-width: 0.117307vw; } #mapColMark td:hover .colBlock { position: absolute; top: 4vw; height: 96vw; - width: 7.15vw; + width: 7.384615vw; z-index: 100; background-color: rgba(38, 166, 154, .5); } @@ -333,12 +335,14 @@ table.row td { padding: 0; border-left-width: 0px; border-right-width: 0px; + border-top-width: 0.117307vw; + border-bottom-width: 0.117397vw; } #mapRowMark td:hover .rowBlock { position: absolute; left: 4vw; - height: 7.15vw; + height: 7.384615vw; width: 96vw; z-index: 100; background-color: rgba(76, 34, 27, .5); diff --git a/docs/event.md b/docs/event.md index 6f159aaa..bb7c6d94 100644 --- a/docs/event.md +++ b/docs/event.md @@ -201,21 +201,21 @@ } ``` -我们可以给文字加上标题或图标,只要以`\t[...]`开头就可以,大致共有如下几种情况: +我们可以给文字加上标题或图标,只要以`\t[...]`开头就可以。 -- `\t[hero]` 显示勇士的图标和名字 -- `\t[monster_id]`显示某个怪物的图标和名字。`monster_id`在`enemys`中有定义,请前往参照。 - - 例如:`\t[blackMagician]` 将显示黑暗大法师的图标和名字。 -- `\t[名字,npc_id]` 显示某个NPC的名字和图标。`npc_id`所对应的图标具体在`icons.js`中有定义,请前往参照。 - - 例如:`\t[小妖精,fairy]` 将显示名字为"小妖精",且是仙子的图标。 -- `\t[标题]` 直接显示标题。 - - 如果该中括号内只有一项,且不为`hero`也不为某个怪物的ID,则会直接显示。如 `\t[你死了]` 直接显示一个标题为"你死了"。 +其一般写法是`\t[名字,ID]`,其中名字为你要显示的标题,ID为图块ID,只能为`hero`,或者NPC/怪物的图块ID。 + +如果不需要可以不写ID,则只会显示标题。 + +对于hero和怪物,也可以不写名字代表使用默认值。 ``` js "x,y": [ // 实际执行的事件列表 "一段普通文字", - "\t[hero]这是一段勇士说的话", - "\t[blackMagician]这是一段黑暗大法师说的话", + "\t[勇士,hero]这是一段勇士说的话", + "\t[hero]如果使用勇士默认名称也可以直接简写hero", + "\t[黑暗大法师,blackMagician]我是黑暗大法师", + "\t[blackMagician]如果使用怪物的默认名称也可以简写怪物id", "\t[小妖精,fairy]这是一段小妖精说的话,使用仙子(fairy)的图标", "\t[你赢了]直接显示标题为【你赢了】", ] diff --git a/libs/control.js b/libs/control.js index 9830011a..9daee5eb 100644 --- a/libs/control.js +++ b/libs/control.js @@ -731,8 +731,19 @@ control.prototype.moveAction = function (callback) { } if (core.status.event.id!='ski') core.status.route.push(direction); - core.trigger(core.getHeroLoc('x'), core.getHeroLoc('y')); + + // 检查是不是无事件的道具 + var nowx = core.getHeroLoc('x'), nowy = core.getHeroLoc('y'); + var block = core.getBlock(nowx,nowy); + var hasTrigger = false; + if (block!=null && block.block.event.trigger=='getItem' && + !core.isset(core.floors[core.status.floorId].afterGetItem[nowx+","+nowy])) { + hasTrigger = true; + core.trigger(nowx, nowy); + } core.checkBlock(); + if (!hasTrigger && !core.status.gameOver) + core.trigger(nowx, nowy); if (core.isset(callback)) callback(); }); } diff --git a/libs/core.js b/libs/core.js index f199fa24..82fdd9ef 100644 --- a/libs/core.js +++ b/libs/core.js @@ -73,6 +73,7 @@ function core() { } this.initStatus = { 'played': false, + 'gameOver': false, // 勇士属性 'hero': {}, @@ -144,6 +145,7 @@ function core() { 'curtainColor': null, 'usingCenterFly':false, 'openingDoor': null, + 'isSkiing': false, // 动画 'globalAnimateObjs': [], diff --git a/libs/events.js b/libs/events.js index 9111d843..877e83b9 100644 --- a/libs/events.js +++ b/libs/events.js @@ -30,6 +30,7 @@ events.prototype.init = function () { heroLoc = {'x': data.event.data.loc[0], 'y': data.event.data.loc[1]}; if (core.isset(data.event.data.direction)) heroLoc.direction = data.event.data.direction; + if (core.status.event.id!='action') core.status.event.id=null; core.changeFloor(data.event.data.floorId, data.event.data.stair, heroLoc, data.event.data.time, function () { if (core.isset(callback)) callback(); @@ -116,11 +117,13 @@ events.prototype.setInitData = function (hard) { ////// 游戏获胜事件 ////// events.prototype.win = function (reason, norank) { + core.status.gameOver = true; return this.eventdata.win(reason, norank); } ////// 游戏失败事件 ////// events.prototype.lose = function (reason) { + core.status.gameOver = true; return this.eventdata.lose(reason); } @@ -868,7 +871,7 @@ events.prototype.doAction = function() { ////// 往当前事件列表之前添加一个或多个事件 ////// events.prototype.insertAction = function (action, x, y, callback) { - if (core.status.event.id == null) { + if (core.status.event.id != 'action') { this.doEvents(action, x, y, callback); } else { @@ -1019,6 +1022,7 @@ events.prototype.battle = function (id, x, y, force, callback) { ////// 触发(x,y)点的事件 ////// events.prototype.trigger = function (x, y) { + core.status.isSkiing = false; var mapBlocks = core.status.thisMap.blocks; var noPass; for (var b = 0; b < mapBlocks.length; b++) { @@ -1030,6 +1034,8 @@ events.prototype.trigger = function (x, y) { if (core.isset(mapBlocks[b].event) && core.isset(mapBlocks[b].event.trigger)) { var trigger = mapBlocks[b].event.trigger; + if (trigger == 'ski') core.status.isSkiing = true; + // 转换楼层能否穿透 if (trigger=='changeFloor' && !noPass) { var canCross = core.flags.portalWithoutTrigger; @@ -1578,7 +1584,7 @@ events.prototype.ski = function (direction) { } else { core.moveHero(direction, function () { - if (core.status.event.id=='ski') { + if (core.status.event.id=='ski' && !core.status.isSkiing) { core.status.event.id=null; core.unLockControl(); core.replay(); diff --git a/libs/ui.js b/libs/ui.js index ec919d78..5a28b569 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -278,8 +278,10 @@ ui.prototype.drawTextBox = function(content) { if (ss.length==1) { // id id=ss[0]; - // monster - if (id!='hero') { + if (id=='hero') { + name = core.status.hero.name; + } + else { if (core.isset(core.material.enemys[id])) { name = core.material.enemys[id].name; @@ -305,20 +307,35 @@ ui.prototype.drawTextBox = function(content) { } } else { - id='npc'; name=ss[0]; - if (core.isset(core.material.icons.npc48[ss[1]])) { + id = 'npc'; + if (ss[1]=='hero') { + id = 'hero'; + } + else if (core.isset(core.material.icons.npc48[ss[1]])) { image = core.material.images.npc48; icon = core.material.icons.npc48[ss[1]]; iconHeight = 48; animate=4; } - else { + else if (core.isset(core.material.icons.npcs[ss[1]])){ image = core.material.images.npcs; icon = core.material.icons.npcs[ss[1]]; iconHeight = 32; animate=2; } + else if (core.isset(core.material.icons.enemy48[ss[1]])) { + image = core.material.images.enemy48; + icon = core.material.icons.enemy48[ss[1]]; + iconHeight = 48; + animate=4; + } + else if (core.isset(core.material.icons.enemys[ss[1]])) { + image = core.material.images.enemys; + icon = core.material.icons.enemys[ss[1]]; + iconHeight = 32; + animate=2; + } } } } @@ -459,7 +476,7 @@ ui.prototype.drawTextBox = function(content) { if (id == 'hero') { var heroHeight=core.material.icons.hero.height; core.strokeRect('ui', left + 15 - 1, top + 40 - 1, 34, heroHeight+2, null, 2); - core.fillText('ui', core.status.hero.name, content_left, top + 30, null, 'bold 22px Verdana'); + core.fillText('ui', name, content_left, top + 30, null, 'bold 22px Verdana'); core.clearMap('ui', left + 15, top + 40, 32, heroHeight); core.fillRect('ui', left + 15, top + 40, 32, heroHeight, background); var heroIcon = core.material.icons.hero['down']; @@ -542,17 +559,20 @@ ui.prototype.drawChoices = function(content, choices) { if (core.isset(content)) { // 获得name, image, icon - if (content.indexOf("\t[")==0) { + if (content.indexOf("\t[")==0 || content.indexOf("\\t[")==0) { var index = content.indexOf("]"); if (index>=0) { var str=content.substring(2, index); + if (content.indexOf("\\t[")==0) str=content.substring(3, index); content=content.substring(index+1); var ss=str.split(","); if (ss.length==1) { // id id=ss[0]; - // monster - if (id!='hero') { + if (id=='hero') { + name = core.status.hero.name; + } + else { if (core.isset(core.material.enemys[id])) { name = core.material.enemys[id].name; @@ -578,20 +598,35 @@ ui.prototype.drawChoices = function(content, choices) { } } else { - id='npc'; name=ss[0]; - if (core.isset(core.material.icons.npc48[ss[1]])) { + id = 'npc'; + if (ss[1]=='hero') { + id = 'hero'; + } + else if (core.isset(core.material.icons.npc48[ss[1]])) { image = core.material.images.npc48; icon = core.material.icons.npc48[ss[1]]; iconHeight = 48; animate=4; } - else { + else if (core.isset(core.material.icons.npcs[ss[1]])){ image = core.material.images.npcs; icon = core.material.icons.npcs[ss[1]]; iconHeight = 32; animate=2; } + else if (core.isset(core.material.icons.enemy48[ss[1]])) { + image = core.material.images.enemy48; + icon = core.material.icons.enemy48[ss[1]]; + iconHeight = 48; + animate=4; + } + else if (core.isset(core.material.icons.enemys[ss[1]])) { + image = core.material.images.enemys; + icon = core.material.icons.enemys[ss[1]]; + iconHeight = 32; + animate=2; + } } } } @@ -631,7 +666,7 @@ ui.prototype.drawChoices = function(content, choices) { if (id == 'hero') { var heroHeight = core.material.icons.hero.height; core.strokeRect('ui', left + 15 - 1, top + 30 - 1, 34, heroHeight+2, '#DDDDDD', 2); - core.fillText('ui', core.status.hero.name, title_offset, top + 27, '#FFD700', 'bold 19px Verdana'); + core.fillText('ui', name, title_offset, top + 27, '#FFD700', 'bold 19px Verdana'); core.clearMap('ui', left + 15, top + 30, 32, heroHeight); core.fillRect('ui', left + 15, top + 30, 32, heroHeight, background); var heroIcon = core.material.icons.hero['down']; diff --git a/project/images/enemys.png b/project/images/enemys.png index 01d4396f..2c29805b 100644 Binary files a/project/images/enemys.png and b/project/images/enemys.png differ