upFloor & downFloor

This commit is contained in:
oc 2018-04-25 14:51:16 +08:00
parent 725bae87eb
commit e01d90cdfd
10 changed files with 143 additions and 87 deletions

View File

@ -125,6 +125,7 @@ editor_file = function (editor, callback) {
name: "0",
canFlyTo: true,
canUseQuickShop: true,
cannotViewMap: false,
images: [],
item_ratio: 1,
firstArrive: [],

View File

@ -165,6 +165,8 @@ floorId指定的是目标楼层的唯一标识符ID
可以指定time指定后切换动画时长为指定的数值。
**从2.1.1开始,楼层属性中提供了`upFloor`和`downFloor`两项。如果设置此项(比如`"upFloor": [2,3]`则写stair:upFloor或者楼传器的落点将用此点来替换楼梯位置即类似于RM中的上箭头。**
## 动画和天气系统
现在我们的H5魔塔支持播放动画也支持天气系统了。

View File

@ -694,8 +694,8 @@ actions.prototype.onmousewheel = function (direct) {
// 浏览地图
if (core.status.lockControl && core.status.event.id == 'viewMaps') {
if (direct==1) core.ui.drawMaps(core.status.event.data+1);
if (direct==-1) core.ui.drawMaps(core.status.event.data-1);
if (direct==1) this.clickViewMaps(6,2);
if (direct==-1) this.clickViewMaps(6,10);
return;
}
}
@ -927,11 +927,21 @@ actions.prototype.keyUpFly = function (keycode) {
////// 查看地图界面时的点击操作 //////
actions.prototype.clickViewMaps = function (x,y) {
var now = core.floorIds.indexOf(core.status.floorId);
var nextId = core.status.event.data;
if(y<=4) {
core.ui.drawMaps(core.status.event.data+1);
nextId++;
while (nextId<core.floorIds.length && nextId!=now && core.floors[core.floorIds[nextId]].cannotViewMap)
nextId++;
if (nextId<core.floorIds.length)
core.ui.drawMaps(nextId);
}
else if (y>=8) {
core.ui.drawMaps(core.status.event.data-1);
nextId--;
while (nextId>=0 && nextId!=now && core.floors[core.floorIds[nextId]].cannotViewMap)
nextId--;
if (nextId>=0)
core.ui.drawMaps(nextId);
}
else {
core.clearMap('data', 0, 0, 416, 416);
@ -942,8 +952,12 @@ actions.prototype.clickViewMaps = function (x,y) {
////// 查看地图界面时,按下某个键的操作 //////
actions.prototype.keyDownViewMaps = function (keycode) {
if (keycode==37 || keycode==38 || keycode==33) core.ui.drawMaps(core.status.event.data+1);
else if (keycode==39 || keycode==40 || keycode==34) core.ui.drawMaps(core.status.event.data-1);
if (keycode==37 || keycode==38 || keycode==33) {
this.clickViewMaps(6,2);
}
else if (keycode==39 || keycode==40 || keycode==34) {
this.clickViewMaps(6,10);
}
return;
}

View File

@ -874,6 +874,11 @@ control.prototype.updateCheckBlock = function() {
core.status.checkBlock.map[13*block.x+block.y]=id;
}
}
// 血网
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) &&
block.event.id=='lavaNet' && block.event.trigger=='passNet' && !core.hasItem("shoes")) {
core.status.checkBlock.map[13*block.x+block.y]="lavaNet";
}
}
// Step2: 更新领域、阻击伤害
@ -884,7 +889,13 @@ control.prototype.updateCheckBlock = function() {
for (var y=0;y<13;y++) {
var id = core.status.checkBlock.map[13*x+y];
if (core.isset(id)) {
var enemy = core.enemys.getEnemys(id);
if (id=="lavaNet") {
core.status.checkBlock.damage[13*x+y]+=core.values.lavaDamage;
continue;
}
var enemy = core.material.enemys[id];
// 存在领域
if (core.enemys.hasSpecial(enemy.special, 15)) {
var range = enemy.range || 1;
@ -925,8 +936,8 @@ control.prototype.updateCheckBlock = function() {
var id1=core.status.checkBlock.map[13*(x-1)+y],
id2=core.status.checkBlock.map[13*(x+1)+y];
if (core.isset(id1) && core.isset(id2) && id1==id2) {
var enemy = core.enemys.getEnemys(id1);
if (core.enemys.hasSpecial(enemy.special, 16)) {
var enemy = core.material.enemys[id1];
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
has = true;
}
}
@ -935,8 +946,8 @@ control.prototype.updateCheckBlock = function() {
var id1=core.status.checkBlock.map[13*x+y-1],
id2=core.status.checkBlock.map[13*x+y+1];
if (core.isset(id1) && core.isset(id2) && id1==id2) {
var enemy = core.enemys.getEnemys(id1);
if (core.enemys.hasSpecial(enemy.special, 16)) {
var enemy = core.material.enemys[id1];
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
has = true;
}
}
@ -982,6 +993,9 @@ control.prototype.checkBlock = function () {
if (core.status.checkBlock.betweenAttack[13*x+y] && damage>0) {
core.drawTip('受到夹击,生命变成一半');
}
else if (core.status.checkBlock.map[13*x+y]=='lavaNet') {
core.drawTip('受到血网伤害'+damage+'点');
}
// 阻击
else if (snipe.length>0 && damage>0) {
core.drawTip('受到阻击伤害'+damage+'点');

View File

@ -884,12 +884,19 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback
heroLoc = core.status.hero.loc;
if (core.isset(stair)) {
if (!core.isset(heroLoc)) heroLoc={};
var blocks = core.status.maps[floorId].blocks;
for (var i in blocks) {
if (core.isset(blocks[i].event) && !(core.isset(blocks[i].enable) && !blocks[i].enable) && blocks[i].event.id === stair) {
heroLoc.x = blocks[i].x;
heroLoc.y = blocks[i].y;
break;
if (core.isset(core.floors[floorId][stair])) {
heroLoc.x = core.floors[floorId][stair][0];
heroLoc.y = core.floors[floorId][stair][1];
}
else {
var blocks = core.status.maps[floorId].blocks;
for (var i in blocks) {
if (core.isset(blocks[i].event) && !(core.isset(blocks[i].enable) && !blocks[i].enable) && blocks[i].event.id === stair) {
heroLoc.x = blocks[i].x;
heroLoc.y = blocks[i].y;
break;
}
}
}
if (!core.isset(heroLoc.x)) {
@ -1162,6 +1169,8 @@ events.prototype.passNet = function (data) {
// 有鞋子
if (core.hasItem('shoes')) return;
if (data.event.id=='lavaNet') { // 血网
// 在checkBlock中进行处理
/*
core.status.hero.hp -= core.values.lavaDamage;
if (core.status.hero.hp<=0) {
core.status.hero.hp=0;
@ -1169,7 +1178,8 @@ events.prototype.passNet = function (data) {
core.events.lose();
return;
}
core.drawTip('经过血网,生命-'+core.values.lavaDamage);
*/
// core.drawTip('经过血网,生命-'+core.values.lavaDamage);
}
if (data.event.id=='poisonNet') { // 毒网
if (core.hasFlag('poison')) return;

View File

@ -30,7 +30,12 @@ loader.prototype.load = function (callback) {
core.loader.loadImages(core.materials, core.material.images, function () {
// 加载png图片
core.material.images.images = {};
core.loader.loadImages(core.images, core.material.images.images, function () {
var images = core.clone(core.images);
if (images.indexOf("hero.png")<0)
images.push("hero.png");
core.loader.loadImages(images, core.material.images.images, function () {
// 加载autotile
core.material.images.autotile = {};
core.loader.loadImages(Object.keys(core.material.icons.autotile), core.material.images.autotile, function () {

View File

@ -256,6 +256,24 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_bool": "bool",
"_data": "该层是否允许使用快捷商店"
},
"cannotViewMap": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "该层是否不允许被浏览地图看到;如果勾上则浏览地图会跳过该层"
},
"upFloor": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==null||((thiseval instanceof Array) && thiseval.length==2)",
"_data": "该层上楼点,如[2,3]。\n如果此项不为null则楼层转换时的stair:upFloor以及楼传器的落点会被替换成该点而不是该层的上楼梯。"
},
"downFloor": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==null||((thiseval instanceof Array) && thiseval.length==2)",
"_data": "该层上楼点,如[2,3]。\n如果此项不为null则楼层转换时的stair:downFloor以及楼传器的落点会被替换成该点而不是该层的下楼梯。"
},
"defaultGround": {
"_leaf": true,
"_type": "select",

View File

@ -135,7 +135,7 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"constants": {
"_leaf": true,
"_type": "textarea",
"_data": "初始永久道具个数,例如初始送手册可以写 {'book': true}"
"_data": "初始永久道具个数,例如初始送手册可以写 {'book': 1}"
},
"tools": {
"_leaf": true,

View File

@ -1,56 +1,35 @@
main.floors.MT0 =
main.floors.MT0=
{
"floorId": "MT0", // 这里需要改楼层名请和文件名及下面的floorId保持完全一致
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
// 推荐用法第20层就用MT20第38层就用MT38地下6层就用MT_6用下划线代替负号隐藏3层用MT3hh表示隐藏等等
// 楼层唯一标识符,需要和名字完全一致
"title": "主塔 0 层", // 楼层中文名
"name": "0", // 显示在状态栏中的层数
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
"canUseQuickShop": true, // 该层是否允许使用快捷商店
"defaultGround": "ground", // 默认地面的图块IDterrains中
"images": [], // 该层默认显示的所有图片;详细用法请查看文档“自定义素材”中的说明。
// "color": [0,0,0,0.3], // 该层的默认画面色调。本项可不写代表无色调如果写需要是一个RGBA数组。
// "weather": ["snow",5], // 该层的默认天气。本项可忽略表示晴天,如果写则第一项为"rain"或"snow"代表雨雪第二项为1-10之间的数代表强度。
// "bgm": "bgm.mp3", // 到达该层后默认播放的BGM。本项可忽略。
"item_ratio": 1, // 该层的宝石/血瓶倍率
"map": [ // 地图数据需要是13x13建议使用地图生成器来生成
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
],
"firstArrive": [ // 第一次到该楼层触发的事件
],
"events": { // 该楼的所有可能事件列表
},
"changeFloor": { // 楼层转换事件该事件不能和上面的events有冲突同位置点否则会被覆盖
},
"afterBattle": { // 战斗后可能触发的事件列表
},
"afterGetItem": { // 获得道具后可能触发的事件列表
},
"afterOpenDoor": { // 开完门后可能触发的事件列表
},
"cannotMove": { // 每个图块不可通行的方向
// 可以在这里定义每个点不能前往哪个方向,例如悬崖边不能跳下去
// "x,y": ["up", "left"], // (x,y)点不能往上和左走
},
}
"floorId": "MT0",
"title": "主塔 0 层",
"name": "0",
"canFlyTo": true,
"canUseQuickShop": true,
"cannotViewMap": false,
"defaultGround": "ground",
"images": [],
"item_ratio": 1,
"map": [
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0,246, 11,246, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 11,219, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0,246, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
],
"firstArrive": [],
"events": {},
"changeFloor": {},
"afterBattle": {},
"afterGetItem": {},
"afterOpenDoor": {},
"cannotMove": {},
"upFloor": null,
}

View File

@ -1,16 +1,29 @@
HTML5魔塔样板V2.1
HTML5魔塔样板V2.1.1
编辑器添加新建和删除按钮;地图自动保存 √
录像支持倒退录像播放中每20步自动存档最多存30个
Gif支持可以作为楼层背景图或者使用显示动图事件 √
图片显示增加淡入淡出效果 √
APP端也能下载或读取文件 √
地图临界显伤 √
单个存档清理 √
大数据魔塔的支持(临界计算等) √
进一步对JS文件和图标进行压缩大幅提高加载速度 √
修复有时候无法输入ID的问题 √
其他细节优化 √
改变勇士行走图
楼传器落点设置 √
录像回放从任意存档点开始
录像过程中允许存档
血网显伤 √
重置当前楼层地图core.resetMap() √
部分楼层不允许浏览地图 √
其他细节优化
-----------------------------------------------------------------------
HTML5魔塔样板V2.1
编辑器添加新建和删除按钮;地图自动保存
录像支持倒退录像播放中每20步自动存档最多存30个
Gif支持可以作为楼层背景图或者使用显示动图事件
图片显示增加淡入淡出效果
APP端也能下载或读取文件
地图临界显伤
单个存档清理
大数据魔塔的支持(临界计算等)
进一步对JS文件和图标进行压缩大幅提高加载速度
修复有时候无法输入ID的问题
其他细节优化
-----------------------------------------------------------------------