多地面素材
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 12 KiB |
30
libs/core.js
@ -136,6 +136,11 @@ core.prototype.init = function (dom, statusBar, canvas, images, sounds, floorIds
|
||||
core.musicStatus.soundStatus = false;
|
||||
}
|
||||
|
||||
// switchs
|
||||
core.flags.battleAnimate = core.getLocalStorage('battleAnimate', core.flags.battleAnimate);
|
||||
core.flags.displayEnemyDamage = core.getLocalStorage('enemyDamage', core.flags.displayEnemyDamage);
|
||||
core.flags.displayExtraDamage = core.getLocalStorage('extraDamage', core.flags.displayExtraDamage);
|
||||
|
||||
core.material.ground = new Image();
|
||||
core.material.ground.src = "images/ground.png";
|
||||
|
||||
@ -1752,13 +1757,13 @@ core.prototype.drawMap = function (mapName, callback) {
|
||||
var mapBlocks = mapData.blocks;
|
||||
core.status.floorId = mapName;
|
||||
core.status.thisMap = mapData;
|
||||
var blockIcon, blockImage;
|
||||
core.clearMap('all');
|
||||
core.removeGlobalAnimate(null, null, true);
|
||||
var groundId = core.floors[mapName].defaultGround || "ground";
|
||||
var blockIcon = core.material.icons.terrains[groundId];
|
||||
var blockImage = core.material.images.terrains;
|
||||
for (var x = 0; x < 13; x++) {
|
||||
for (var y = 0; y < 13; y++) {
|
||||
blockIcon = core.material.icons.terrains.ground;
|
||||
blockImage = core.material.images.terrains;
|
||||
core.canvas.bg.drawImage(blockImage, 0, blockIcon * 32, 32, 32, x * 32, y * 32, 32, 32);
|
||||
}
|
||||
}
|
||||
@ -1780,14 +1785,14 @@ core.prototype.drawMap = function (mapName, callback) {
|
||||
}
|
||||
}
|
||||
}
|
||||
core.drawAutotile('event', autotileMaps, 0, 0, 32);
|
||||
core.drawAutotile(mapName, 'event', autotileMaps, 0, 0, 32);
|
||||
core.setGlobalAnimate(core.values.animateSpeed);
|
||||
|
||||
if (core.isset(callback))
|
||||
callback();
|
||||
}
|
||||
|
||||
core.prototype.drawAutotile = function (canvas, autotileMaps, left, top, size) {
|
||||
core.prototype.drawAutotile = function (floorId, canvas, autotileMaps, left, top, size) {
|
||||
var isAutotile = function(x, y) {
|
||||
if (x<0 || x>12 || y<0 || y>12) return 0;
|
||||
return autotileMaps[13*x+y]?1:0;
|
||||
@ -1797,7 +1802,7 @@ core.prototype.drawAutotile = function (canvas, autotileMaps, left, top, size) {
|
||||
if (isAutotile(xx, yy)) {
|
||||
// 绘制autotile
|
||||
var id=isAutotile(xx, yy - 1) + 2 * isAutotile(xx - 1, yy) + 4 * isAutotile(xx, yy + 1) + 8 * isAutotile(xx + 1, yy);
|
||||
core.drawAutotileBlock(canvas, left + xx * size, top + yy * size, size, core.material.images.autotile, id);
|
||||
core.drawAutotileBlock(floorId, canvas, left + xx * size, top + yy * size, size, core.material.images.autotile, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1805,24 +1810,25 @@ core.prototype.drawAutotile = function (canvas, autotileMaps, left, top, size) {
|
||||
for (var yy=0;yy<13;yy++) {
|
||||
if (isAutotile(xx, yy) + isAutotile(xx + 1, yy) + isAutotile(xx + 1, yy + 1) + isAutotile(xx, yy + 1) != 3) continue;
|
||||
if (!isAutotile(xx, yy)) {
|
||||
core.drawAutotileBlock(canvas, left + xx * size + size, top + yy * size + size, size, core.material.images.autotile, 16);
|
||||
core.drawAutotileBlock(floorId, canvas, left + xx * size + size, top + yy * size + size, size, core.material.images.autotile, 16);
|
||||
}
|
||||
if (!isAutotile(xx + 1, yy)) {
|
||||
core.drawAutotileBlock(canvas, left + xx * size + size / 2, top + yy * size + size, size, core.material.images.autotile, 17);
|
||||
core.drawAutotileBlock(floorId, canvas, left + xx * size + size / 2, top + yy * size + size, size, core.material.images.autotile, 17);
|
||||
}
|
||||
if (!isAutotile(xx + 1, yy + 1)) {
|
||||
core.drawAutotileBlock(canvas, left + xx * size + size / 2, top + yy * size + size / 2, size, core.material.images.autotile, 18);
|
||||
core.drawAutotileBlock(floorId, canvas, left + xx * size + size / 2, top + yy * size + size / 2, size, core.material.images.autotile, 18);
|
||||
}
|
||||
if (!isAutotile(xx, yy + 1)) {
|
||||
core.drawAutotileBlock(canvas, left + xx * size + size, top + yy * size + size / 2, size, core.material.images.autotile, 19);
|
||||
core.drawAutotileBlock(floorId, canvas, left + xx * size + size, top + yy * size + size / 2, size, core.material.images.autotile, 19);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
core.prototype.drawAutotileBlock = function (map, x, y, size, autotile, index) {
|
||||
core.prototype.drawAutotileBlock = function (floorId, map, x, y, size, autotile, index) {
|
||||
var canvas = core.canvas[map];
|
||||
var blockIcon = core.material.icons.terrains.ground;
|
||||
var groundId = core.floors[floorId].defaultGround || "ground";
|
||||
var blockIcon = core.material.icons.terrains[groundId];
|
||||
var blockImage = core.material.images.terrains;
|
||||
switch (index) {
|
||||
case 0:
|
||||
|
||||
@ -128,6 +128,7 @@ data.prototype.init = function() {
|
||||
"bigKeyIsBox": false, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙
|
||||
/****** 系统相关 ******/
|
||||
"startDirectly": false, // 点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面
|
||||
"showBattleAnimateConfirm": true, // 是否在游戏开始时提供“是否开启战斗动画”的选项
|
||||
"battleAnimate": true, // 是否默认显示战斗动画;用户可以手动在菜单栏中开关
|
||||
"displayEnemyDamage": true, // 是否地图怪物显伤;用户可以手动在菜单栏中开关
|
||||
"displayExtraDamage": false, // 是否地图高级显伤(领域、夹击等);用户可以手动在菜单栏中开关
|
||||
|
||||
@ -66,17 +66,24 @@ events.prototype.startGame = function (hard) {
|
||||
|
||||
core.hideStartAnimate(function() {
|
||||
core.drawText(core.clone(core.firstData.startText), function() {
|
||||
core.status.event.selection = core.flags.battleAnimate?0:1;
|
||||
core.ui.drawConfirmBox("你想开启战斗动画吗?\n之后可以在菜单栏中开启或关闭。\n(强烈建议新手开启此项)", function() {
|
||||
console.log("1234");
|
||||
core.flags.battleAnimate=true;
|
||||
if (core.flags.showBattleAnimateConfirm) { // 是否提供“开启战斗动画”的选择项
|
||||
core.status.event.selection = core.flags.battleAnimate ? 0 : 1;
|
||||
core.ui.drawConfirmBox("你想开启战斗动画吗?\n之后可以在菜单栏中开启或关闭。\n(强烈建议新手开启此项)", function () {
|
||||
core.flags.battleAnimate = true;
|
||||
core.setLocalStorage('battleAnimate', true);
|
||||
core.startGame(hard);
|
||||
core.events.setInitData(hard);
|
||||
}, function () {
|
||||
core.flags.battleAnimate = false;
|
||||
core.setLocalStorage('battleAnimate', false);
|
||||
core.startGame(hard);
|
||||
core.events.setInitData(hard);
|
||||
});
|
||||
}
|
||||
else {
|
||||
core.startGame(hard);
|
||||
core.events.setInitData(hard);
|
||||
}, function() {
|
||||
core.flags.battleAnimate=false;
|
||||
core.startGame(hard);
|
||||
core.events.setInitData(hard);
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
@ -1119,23 +1126,25 @@ events.prototype.clickSwitchs = function (x,y) {
|
||||
break;
|
||||
case 1:
|
||||
core.flags.battleAnimate=!core.flags.battleAnimate;
|
||||
core.setLocalStorage('battleAnimate', core.flags.battleAnimate);
|
||||
core.ui.drawSwitchs();
|
||||
break;
|
||||
case 2:
|
||||
core.flags.displayEnemyDamage=!core.flags.displayEnemyDamage;
|
||||
core.updateFg();
|
||||
core.setLocalStorage('enemyDamage', core.flags.displayEnemyDamage);
|
||||
core.ui.drawSwitchs();
|
||||
break;
|
||||
case 3:
|
||||
core.flags.displayExtraDamage=!core.flags.displayExtraDamage;
|
||||
core.updateFg();
|
||||
core.setLocalStorage('extraDamage', core.flags.displayExtraDamage);
|
||||
core.ui.drawSwitchs();
|
||||
break;
|
||||
case 4:
|
||||
core.status.event.selection=0;
|
||||
core.ui.drawSettings(false);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ main.floors.MT0 = {
|
||||
"name": 0, // 显示在状态栏中的层数
|
||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||
"defaultGround": "ground", // 默认地面的图块ID(terrains中)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
|
||||
],
|
||||
|
||||
@ -7,6 +7,7 @@ main.floors.sample0 = {
|
||||
"name": 0, // 显示在状态栏中的层数
|
||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||
"defaultGround": "ground", // 默认地面的图块ID(terrains中)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
[0, 0, 220, 0, 0, 20, 87, 3, 65, 64, 44, 43, 42],
|
||||
[0, 246, 0, 246, 0, 20, 0, 3, 58, 59, 60, 61, 41],
|
||||
|
||||
@ -7,6 +7,7 @@ main.floors.sample1 = {
|
||||
"name": 1, // 显示在状态栏中的层数
|
||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||
"defaultGround": "grass", // 默认地面的图块ID(terrains中)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
[7, 131, 8, 2, 9, 130, 10, 2, 166, 165, 132, 165, 166],
|
||||
[0, 0, 0, 0, 0, 0, 0, 2, 165, 164, 0, 162, 165],
|
||||
|
||||
@ -7,6 +7,7 @@ main.floors.sample2 = {
|
||||
"name": 40, // 显示在状态栏中的层数
|
||||
"canFlyTo": false, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||
"defaultGround": "soil", // 默认地面的图块ID(terrains中)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
[5, 5, 5, 5, 5, 5, 87, 5, 5, 5, 5, 5, 5],
|
||||
[5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
|
||||
|
||||
@ -12,30 +12,46 @@ icons.prototype.init = function () {
|
||||
},
|
||||
'terrains': {
|
||||
'ground': 0,
|
||||
'yellowWall': 1,
|
||||
'whiteWall': 2,
|
||||
'blueWall': 3,
|
||||
'star': 4,
|
||||
'lava': 5,
|
||||
'ice': 6,
|
||||
'downFloor': 7,
|
||||
'upFloor': 8,
|
||||
'yellowDoor': 9,
|
||||
'blueDoor': 10,
|
||||
'redDoor': 11,
|
||||
'greenDoor': 12,
|
||||
'specialDoor': 13,
|
||||
'steelDoor': 14,
|
||||
'blueShop-left': 15,
|
||||
'blueShop-right': 16,
|
||||
'pinkShop-left': 17,
|
||||
'pinkShop-right': 18,
|
||||
'arrowUp': 19,
|
||||
'arrowDown': 20,
|
||||
'arrowLeft': 21,
|
||||
'arrowRight': 22,
|
||||
'light': 23,
|
||||
'darkLight': 24
|
||||
'grass': 1,
|
||||
'grass2': 2,
|
||||
'snow': 3,
|
||||
'ground2': 4,
|
||||
'ground3': 5,
|
||||
'ground4': 6,
|
||||
'sand': 7,
|
||||
'ground5': 8,
|
||||
'yellowWall2': 9,
|
||||
'whiteWall2': 10,
|
||||
'blueWall2': 11,
|
||||
'blockWall': 12,
|
||||
'grayWall': 13,
|
||||
'white': 14,
|
||||
'ground6': 15,
|
||||
'soil': 16,
|
||||
'yellowWall': 17,
|
||||
'whiteWall': 18,
|
||||
'blueWall': 19,
|
||||
'star': 20,
|
||||
'lava': 21,
|
||||
'ice': 22,
|
||||
'downFloor': 23,
|
||||
'upFloor': 24,
|
||||
'yellowDoor': 25,
|
||||
'blueDoor': 26,
|
||||
'redDoor': 27,
|
||||
'greenDoor': 28,
|
||||
'specialDoor': 29,
|
||||
'steelDoor': 30,
|
||||
'blueShop-left': 31,
|
||||
'blueShop-right': 32,
|
||||
'pinkShop-left': 33,
|
||||
'pinkShop-right': 34,
|
||||
'arrowUp': 35,
|
||||
'arrowDown': 36,
|
||||
'arrowLeft': 37,
|
||||
'arrowRight': 38,
|
||||
'light': 39,
|
||||
'darkLight': 40
|
||||
},
|
||||
'animates': {
|
||||
'star': 0,
|
||||
|
||||
13
libs/maps.js
@ -34,7 +34,7 @@ maps.prototype.loadFloor = function (floorId, map) {
|
||||
}
|
||||
}
|
||||
}
|
||||
this.addEvent(block,j,i,floor.events[j+","+i])
|
||||
this.addEvent(block,j,i,floor.events[j+","+i],floor.defaultGround || "ground")
|
||||
this.addChangeFloor(block,j,i,floor.changeFloor[j+","+i]);
|
||||
if (core.isset(block.event)) blocks.push(block);
|
||||
}
|
||||
@ -78,8 +78,11 @@ maps.prototype.getBlock = function (x, y, id) {
|
||||
if (id == 14) tmp.event = {'cls': 'animates', 'id': 'curseNet', 'noPass': false, 'trigger': 'passNet'}; // 咒网
|
||||
if (id == 15) tmp.event = {'cls': 'animates', 'id': 'water', 'noPass': true}; // 水
|
||||
|
||||
|
||||
// autotile: 20
|
||||
if (id == 20) tmp.event = {'cls': 'autotile', 'id': 'autotile', 'noPass': true}; // autotile
|
||||
// 更多的autotile从350继续放
|
||||
|
||||
|
||||
// 21-80 物品
|
||||
if (id == 21) tmp.event = {'cls': 'items', 'id': 'yellowKey'}; // 黄钥匙
|
||||
@ -232,10 +235,10 @@ maps.prototype.getBlock = function (x, y, id) {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
maps.prototype.addEvent = function (block, x, y, event) {
|
||||
maps.prototype.addEvent = function (block, x, y, event, ground) {
|
||||
if (!core.isset(event)) return;
|
||||
if (!core.isset(block.event)) { // 本身是空地?
|
||||
block.event = {'cls': 'terrains', 'id': 'ground', 'noPass': false};
|
||||
block.event = {'cls': 'terrains', 'id': ground, 'noPass': false};
|
||||
}
|
||||
// event是字符串或数组?
|
||||
if (typeof event == "string") {
|
||||
@ -267,9 +270,9 @@ maps.prototype.addEvent = function (block, x, y, event) {
|
||||
}
|
||||
}
|
||||
|
||||
maps.prototype.addChangeFloor = function (block, x, y, event) {
|
||||
maps.prototype.addChangeFloor = function (block, x, y, event, ground) {
|
||||
if (!core.isset(event)) return;
|
||||
this.addEvent(block, x, y, {"trigger": "changeFloor", "data": event});
|
||||
this.addEvent(block, x, y, {"trigger": "changeFloor", "data": event}, ground);
|
||||
}
|
||||
|
||||
maps.prototype.initMaps = function (floorIds) {
|
||||
|
||||
15
libs/ui.js
@ -856,7 +856,7 @@ ui.prototype.drawFly = function(page) {
|
||||
if (page>0)
|
||||
core.fillText('ui', '▼', 356, 247+64, '#FFFFFF', "17px Verdana");
|
||||
core.strokeRect('ui', 20, 100, 273, 273, '#FFFFFF', 2);
|
||||
this.drawThumbnail('ui', core.status.maps[floorId].blocks, 20, 100, 273);
|
||||
this.drawThumbnail(floorId, 'ui', core.status.maps[floorId].blocks, 20, 100, 273);
|
||||
}
|
||||
|
||||
ui.prototype.drawToolbox = function(index) {
|
||||
@ -1003,7 +1003,7 @@ ui.prototype.drawSLPanel = function(index) {
|
||||
core.fillText('ui', name+id, (2*i+1)*u, 35, '#FFFFFF', "bold 17px Verdana");
|
||||
core.strokeRect('ui', (2*i+1)*u-size/2, 50, size, size, id==index?'#FFD700':'#FFFFFF', id==index?6:2);
|
||||
if (core.isset(data) && core.isset(data.floorId)) {
|
||||
this.drawThumbnail('ui', core.maps.load(data.maps, data.floorId).blocks, (2*i+1)*u-size/2, 50, size, data.hero.loc);
|
||||
this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i+1)*u-size/2, 50, size, data.hero.loc);
|
||||
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i+1)*u, 65+size, '#FFFFFF', '10px Verdana');
|
||||
}
|
||||
else {
|
||||
@ -1015,7 +1015,7 @@ ui.prototype.drawSLPanel = function(index) {
|
||||
core.fillText('ui', name+id, (2*i-5)*u, 230, '#FFFFFF', "bold 17px Verdana");
|
||||
core.strokeRect('ui', (2*i-5)*u-size/2, 245, size, size, id==index?'#FFD700':'#FFFFFF', id==index?6:2);
|
||||
if (core.isset(data) && core.isset(data.floorId)) {
|
||||
this.drawThumbnail('ui', core.maps.load(data.maps, data.floorId).blocks, (2*i-5)*u-size/2, 245, size, data.hero.loc);
|
||||
this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i-5)*u-size/2, 245, size, data.hero.loc);
|
||||
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i-5)*u, 260+size, '#FFFFFF', '10px Verdana');
|
||||
}
|
||||
else {
|
||||
@ -1027,13 +1027,14 @@ ui.prototype.drawSLPanel = function(index) {
|
||||
this.drawPagination(page+1, 30);
|
||||
}
|
||||
|
||||
ui.prototype.drawThumbnail = function(canvas, blocks, x, y, size, heroLoc) {
|
||||
ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, heroLoc) {
|
||||
core.clearMap(canvas, x, y, size, size);
|
||||
var groundId = core.floors[floorId].defaultGround || "ground";
|
||||
var blockIcon = core.material.icons.terrains[groundId];
|
||||
var blockImage = core.material.images.terrains;
|
||||
var persize = size/13;
|
||||
for (var i=0;i<13;i++) {
|
||||
for (var j=0;j<13;j++) {
|
||||
var blockIcon = core.material.icons.terrains.ground;
|
||||
var blockImage = core.material.images.terrains;
|
||||
core.canvas[canvas].drawImage(blockImage, 0, blockIcon * 32, 32, 32, x + i * persize, y + j * persize, persize, persize);
|
||||
}
|
||||
}
|
||||
@ -1053,7 +1054,7 @@ ui.prototype.drawThumbnail = function(canvas, blocks, x, y, size, heroLoc) {
|
||||
}
|
||||
}
|
||||
}
|
||||
core.drawAutotile('ui', autotileMaps, x, y, persize);
|
||||
core.drawAutotile(floorId, 'ui', autotileMaps, x, y, persize);
|
||||
|
||||
if (core.isset(heroLoc)) {
|
||||
var heroIcon = core.material.icons.hero[heroLoc.direction];
|
||||
|
||||