Update BigMap: Reformat & Fix & Add damage display
This commit is contained in:
parent
edef2beb1d
commit
4dcfcbd702
@ -252,92 +252,6 @@ editor.prototype.updateMap = function () {
|
|||||||
}
|
}
|
||||||
//ctx.drawImage(editor.material.images[tileInfo.images], 0, tileInfo.y*32, 32, 32, x*32, y*32, 32, 32);
|
//ctx.drawImage(editor.material.images[tileInfo.images], 0, tileInfo.y*32, 32, 32, x*32, y*32, 32, 32);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
// autotile的相关处理
|
|
||||||
var indexArrs = [ //16种组合的图块索引数组; // 将autotile分割成48块16*16的小块; 数组索引即对应各个小块
|
|
||||||
// +----+----+----+----+----+----+
|
|
||||||
[10, 9, 4, 3 ], //0 bin:0000 | 1 | 2 | 3 | 4 | 5 | 6 |
|
|
||||||
[10, 9, 4, 13], //1 bin:0001 +----+----+----+----+----+----+
|
|
||||||
[10, 9, 18, 3 ], //2 bin:0010 | 7 | 8 | 9 | 10 | 11 | 12 |
|
|
||||||
[10, 9, 16, 15], //3 bin:0011 +----+----+----+----+----+----+
|
|
||||||
[10, 43, 4, 3 ], //4 bin:0100 | 13 | 14 | 15 | 16 | 17 | 18 |
|
|
||||||
[10, 31, 4, 25], //5 bin:0101 +----+----+----+----+----+----+
|
|
||||||
[10, 7, 2, 3 ], //6 bin:0110 | 19 | 20 | 21 | 22 | 23 | 24 |
|
|
||||||
[10, 31, 16, 5 ], //7 bin:0111 +----+----+----+----+----+----+
|
|
||||||
[48, 9, 4, 3 ], //8 bin:1000 | 25 | 26 | 27 | 28 | 29 | 30 |
|
|
||||||
[ 8, 9, 4, 1 ], //9 bin:1001 +----+----+----+----+----+----+
|
|
||||||
[36, 9, 30, 3 ], //10 bin:1010 | 31 | 32 | 33 | 34 | 35 | 36 |
|
|
||||||
[36, 9, 6, 15], //11 bin:1011 +----+----+----+----+----+----+
|
|
||||||
[46, 45, 4, 3 ], //12 bin:1100 | 37 | 38 | 39 | 40 | 41 | 42 |
|
|
||||||
[46, 11, 4, 25], //13 bin:1101 +----+----+----+----+----+----+
|
|
||||||
[12, 45, 30, 3 ], //14 bin:1110 | 43 | 44 | 45 | 46 | 47 | 48 |
|
|
||||||
[34, 33, 28, 27] //15 bin:1111 +----+----+----+----+----+----+
|
|
||||||
];
|
|
||||||
var drawBlockByIndex = function(ctx, dx, dy, autotileImg, index){ //index为autotile的图块索引1-48
|
|
||||||
var sx = 16*((index-1)%6), sy = 16*(~~((index-1)/6));
|
|
||||||
ctx.drawImage(autotileImg, sx, sy, 16, 16, dx, dy, 16, 16);
|
|
||||||
}
|
|
||||||
var isAutotile = function(info){
|
|
||||||
if(typeof(info)=='object' && hasOwnProp(info, 'images') && info.images=='autotile') return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var getAutotileAroundId = function(currId, x, y){ //与autotile当前idnum一致返回1,否则返回0
|
|
||||||
if(x>=0 && y >=0 && x<13 && y<13 && isAutotile(editor.map[y][x]) && editor.map[y][x].idnum == currId)
|
|
||||||
return 1;
|
|
||||||
else if(x<0 || y<0 || x>12 || y>12) return 1; //边界外视为通用autotile,这样好看些
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
var checkAround = function(x, y){ // 得到周围四个32*32块(周围每块都包含当前块的1/4,不清楚的话画下图你就明白)的数组索引
|
|
||||||
var currId = editor.map[y][x].idnum;
|
|
||||||
var pointBlock = [];
|
|
||||||
for(var i=0; i<4; i++){
|
|
||||||
var bsum = 0;
|
|
||||||
var offsetx = i%2, offsety = ~~(i/2);
|
|
||||||
for(var j=0; j<4; j++){
|
|
||||||
var mx = j%2, my = ~~(j/2);
|
|
||||||
var b = getAutotileAroundId(currId, x+offsetx+mx-1, y+offsety+my-1);
|
|
||||||
bsum += b*(Math.pow(2, 3-j));
|
|
||||||
}
|
|
||||||
pointBlock.push(bsum);
|
|
||||||
}
|
|
||||||
return pointBlock;
|
|
||||||
}
|
|
||||||
var addIndexToAutotileInfo = function(x, y){
|
|
||||||
var indexArr = [];
|
|
||||||
var pointBlocks = checkAround(x, y);
|
|
||||||
for(var i=0; i<4; i++){
|
|
||||||
var arr = indexArrs[pointBlocks[i]]
|
|
||||||
indexArr.push(arr[3-i]);
|
|
||||||
}
|
|
||||||
editor.map[y][x].blockIndex = indexArr;
|
|
||||||
}
|
|
||||||
var drawAutotile = function(ctx, x, y, info){ // 绘制一个autotile
|
|
||||||
ctx.clearRect(x*32, y*32, 32, 32);
|
|
||||||
//修正四个边角的固定搭配
|
|
||||||
if(info.blockIndex[0] == 13){
|
|
||||||
if(info.blockIndex[1] == 16) info.blockIndex[1] = 14;
|
|
||||||
if(info.blockIndex[2] == 31) info.blockIndex[2] = 19;
|
|
||||||
}
|
|
||||||
if(info.blockIndex[1] == 18){
|
|
||||||
if(info.blockIndex[0] == 15) info.blockIndex[0] = 17;
|
|
||||||
if(info.blockIndex[3] == 36) info.blockIndex[3] = 24;
|
|
||||||
}
|
|
||||||
if(info.blockIndex[2] == 43){
|
|
||||||
if(info.blockIndex[0] == 25) info.blockIndex[0] = 37;
|
|
||||||
if(info.blockIndex[3] == 46) info.blockIndex[3] = 44;
|
|
||||||
}
|
|
||||||
if(info.blockIndex[3] == 48){
|
|
||||||
if(info.blockIndex[1] == 30) info.blockIndex[1] = 42;
|
|
||||||
if(info.blockIndex[2] == 45) info.blockIndex[2] = 47;
|
|
||||||
}
|
|
||||||
for(var i=0; i<4; i++){
|
|
||||||
var index = info.blockIndex[i];
|
|
||||||
var dx = x*32 + 16*(i%2), dy = y*32 + 16*(~~(i/2));
|
|
||||||
drawBlockByIndex(ctx, dx, dy, editor.material.images[info.images][info.id], index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// 绘制地图 start
|
// 绘制地图 start
|
||||||
var eventCtx = document.getElementById('event').getContext("2d");
|
var eventCtx = document.getElementById('event').getContext("2d");
|
||||||
for (var y = 0; y < 13; y++)
|
for (var y = 0; y < 13; y++)
|
||||||
|
|||||||
@ -299,7 +299,7 @@ enemys.prototype.calDamage = function (monster, hero_hp, hero_atk, hero_def, her
|
|||||||
// 检查领域、夹击、阻击事件
|
// 检查领域、夹击、阻击事件
|
||||||
control.prototype.checkBlock = function () {
|
control.prototype.checkBlock = function () {
|
||||||
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y');
|
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y');
|
||||||
var damage = core.status.checkBlock.damage[13*x+y];
|
var damage = core.status.checkBlock.damage[x+core.bigmap.width*y];
|
||||||
if (damage>0) {
|
if (damage>0) {
|
||||||
if (core.hasFlag("shield5")) damage = 0; // 如果存在神圣盾,则将伤害变成0
|
if (core.hasFlag("shield5")) damage = 0; // 如果存在神圣盾,则将伤害变成0
|
||||||
core.status.hero.hp -= damage;
|
core.status.hero.hp -= damage;
|
||||||
|
|||||||
@ -429,7 +429,7 @@ actions.prototype.ondown = function (x ,y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
core.status.downTime = new Date();
|
core.status.downTime = new Date();
|
||||||
core.clearMap('ui', 0, 0, 416,416);
|
core.clearMap('ui');
|
||||||
var pos={'x':x,'y':y}
|
var pos={'x':x,'y':y}
|
||||||
core.status.stepPostfix=[];
|
core.status.stepPostfix=[];
|
||||||
core.status.stepPostfix.push(pos);
|
core.status.stepPostfix.push(pos);
|
||||||
@ -553,9 +553,7 @@ actions.prototype.onclick = function (x, y, stepPostfix) {
|
|||||||
|
|
||||||
// 寻路
|
// 寻路
|
||||||
if (!core.status.lockControl) {
|
if (!core.status.lockControl) {
|
||||||
var dx = ~~(core.maps.currentOffsetPos.x/32);
|
core.setAutomaticRoute(x+parseInt(core.bigmap.offsetX/32), y+parseInt(core.bigmap.offsetY/32), stepPostfix);
|
||||||
var dy = ~~(core.maps.currentOffsetPos.y/32);
|
|
||||||
core.setAutomaticRoute(x+dx, y+dy, stepPostfix);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -925,7 +923,7 @@ actions.prototype.keyUpBook = function (keycode) {
|
|||||||
|
|
||||||
////// 怪物手册属性显示界面时的点击操作 //////
|
////// 怪物手册属性显示界面时的点击操作 //////
|
||||||
actions.prototype.clickBookDetail = function () {
|
actions.prototype.clickBookDetail = function () {
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
core.status.event.id = 'book';
|
core.status.event.id = 'book';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -987,7 +985,7 @@ actions.prototype.clickViewMaps = function (x,y) {
|
|||||||
core.ui.drawMaps(nextId);
|
core.ui.drawMaps(nextId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
core.setOpacity('data', 1);
|
core.setOpacity('data', 1);
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
}
|
}
|
||||||
@ -1007,7 +1005,7 @@ actions.prototype.keyDownViewMaps = function (keycode) {
|
|||||||
////// 查看地图界面时,放开某个键的操作 //////
|
////// 查看地图界面时,放开某个键的操作 //////
|
||||||
actions.prototype.keyUpViewMaps = function (keycode) {
|
actions.prototype.keyUpViewMaps = function (keycode) {
|
||||||
if (keycode==27 || keycode==13 || keycode==32 || keycode==67) {
|
if (keycode==27 || keycode==13 || keycode==32 || keycode==67) {
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
core.setOpacity('data', 1);
|
core.setOpacity('data', 1);
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
}
|
}
|
||||||
|
|||||||
143
libs/control.js
143
libs/control.js
@ -104,7 +104,7 @@ control.prototype.setRequestAnimationFrame = function () {
|
|||||||
if (core.isPlaying() && timestamp-core.animateFrame.weather.time>30) {
|
if (core.isPlaying() && timestamp-core.animateFrame.weather.time>30) {
|
||||||
if (core.animateFrame.weather.type == 'rain' && core.animateFrame.weather.level > 0) {
|
if (core.animateFrame.weather.type == 'rain' && core.animateFrame.weather.level > 0) {
|
||||||
|
|
||||||
core.clearMap('weather', 0, 0, 416, 416);
|
core.clearMap('weather');
|
||||||
|
|
||||||
core.canvas.weather.strokeStyle = 'rgba(174,194,224,0.8)';
|
core.canvas.weather.strokeStyle = 'rgba(174,194,224,0.8)';
|
||||||
core.canvas.weather.lineWidth = 1;
|
core.canvas.weather.lineWidth = 1;
|
||||||
@ -130,7 +130,7 @@ control.prototype.setRequestAnimationFrame = function () {
|
|||||||
}
|
}
|
||||||
else if (core.animateFrame.weather.type == 'snow' && core.animateFrame.weather.level > 0) {
|
else if (core.animateFrame.weather.type == 'snow' && core.animateFrame.weather.level > 0) {
|
||||||
|
|
||||||
core.clearMap('weather', 0, 0, 416, 416);
|
core.clearMap('weather');
|
||||||
|
|
||||||
core.canvas.weather.fillStyle = "rgba(255, 255, 255, 0.8)";
|
core.canvas.weather.fillStyle = "rgba(255, 255, 255, 0.8)";
|
||||||
core.canvas.weather.beginPath();
|
core.canvas.weather.beginPath();
|
||||||
@ -378,7 +378,7 @@ control.prototype.clearContinueAutomaticRoute = function () {
|
|||||||
control.prototype.moveDirectly = function (destX, destY) {
|
control.prototype.moveDirectly = function (destX, destY) {
|
||||||
var ignoreSteps = core.canMoveDirectly(destX, destY);
|
var ignoreSteps = core.canMoveDirectly(destX, destY);
|
||||||
if (ignoreSteps>=0) {
|
if (ignoreSteps>=0) {
|
||||||
core.clearMap('hero', 0, 0, 416, 416);
|
core.clearMap('hero');
|
||||||
var lastDirection = core.status.route[core.status.route.length-1];
|
var lastDirection = core.status.route[core.status.route.length-1];
|
||||||
if (['left', 'right', 'up', 'down'].indexOf(lastDirection)>=0)
|
if (['left', 'right', 'up', 'down'].indexOf(lastDirection)>=0)
|
||||||
core.setHeroLoc('direction', lastDirection);
|
core.setHeroLoc('direction', lastDirection);
|
||||||
@ -398,7 +398,7 @@ control.prototype.tryMoveDirectly = function (destX, destY) {
|
|||||||
if (Math.abs(core.getHeroLoc('x')-destX)+Math.abs(core.getHeroLoc('y')-destY)<=1)
|
if (Math.abs(core.getHeroLoc('x')-destX)+Math.abs(core.getHeroLoc('y')-destY)<=1)
|
||||||
return false;
|
return false;
|
||||||
var testMove = function (dx, dy, dir) {
|
var testMove = function (dx, dy, dir) {
|
||||||
if (dx<0 || dx>12 || dy<0 || dy>12) return false;
|
if (dx<0 || dx>=core.bigmap.width|| dy<0 || dy>core.bigmap.height) return false;
|
||||||
if (core.control.moveDirectly(dx, dy)) {
|
if (core.control.moveDirectly(dx, dy)) {
|
||||||
if (core.isset(dir)) core.moveHero(dir, function() {});
|
if (core.isset(dir)) core.moveHero(dir, function() {});
|
||||||
return true;
|
return true;
|
||||||
@ -542,9 +542,9 @@ control.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) {
|
|||||||
|
|
||||||
////// 自动寻路算法,找寻最优路径 //////
|
////// 自动寻路算法,找寻最优路径 //////
|
||||||
control.prototype.automaticRoute = function (destX, destY) {
|
control.prototype.automaticRoute = function (destX, destY) {
|
||||||
var fw = core.floors[core.status.floorId].tileWidth;
|
var fw = core.bigmap.width;
|
||||||
var fh = core.floors[core.status.floorId].tileHeight
|
var fh = core.bigmap.height;
|
||||||
var tsize = fw * fw;
|
var total = fw * fh;
|
||||||
var startX = core.getHeroLoc('x');
|
var startX = core.getHeroLoc('x');
|
||||||
var startY = core.getHeroLoc('y');
|
var startY = core.getHeroLoc('y');
|
||||||
var scan = {
|
var scan = {
|
||||||
@ -559,17 +559,17 @@ control.prototype.automaticRoute = function (destX, destY) {
|
|||||||
var ans = []
|
var ans = []
|
||||||
|
|
||||||
if (destX == startX && destY == startY) return false;
|
if (destX == startX && destY == startY) return false;
|
||||||
queue.push(fw * startX + startY);
|
queue.push(startX + fw * startY);
|
||||||
queue.push(-1);
|
queue.push(-1);
|
||||||
route[fw * startX + startY] = '';
|
route[startX + fw * startY] = '';
|
||||||
|
|
||||||
while (queue.length != 1) {
|
while (queue.length != 1) {
|
||||||
var f = queue.shift();
|
var f = queue.shift();
|
||||||
if (f===-1) {nowDeep+=1;queue.push(-1);continue;}
|
if (f===-1) {nowDeep+=1;queue.push(-1);continue;}
|
||||||
var deep = ~~(f/tsize);
|
var deep = parseInt(f/total);
|
||||||
if (deep!==nowDeep) {queue.push(f);continue;}
|
if (deep!==nowDeep) {queue.push(f);continue;}
|
||||||
f=f%tsize;
|
f=f%total;
|
||||||
var nowX = parseInt(f / fw), nowY = f % fw;
|
var nowX = parseInt(f % fw), nowY = parseInt(f / fw);
|
||||||
var nowIsArrow = false, nowId, nowBlock = core.getBlock(nowX,nowY);
|
var nowIsArrow = false, nowId, nowBlock = core.getBlock(nowX,nowY);
|
||||||
for (var direction in scan) {
|
for (var direction in scan) {
|
||||||
if (!core.canMoveHero(nowX, nowY, direction))
|
if (!core.canMoveHero(nowX, nowY, direction))
|
||||||
@ -580,7 +580,7 @@ control.prototype.automaticRoute = function (destX, destY) {
|
|||||||
|
|
||||||
if (nx<0 || nx>=fw || ny<0 || ny>=fh) continue;
|
if (nx<0 || nx>=fw || ny<0 || ny>=fh) continue;
|
||||||
|
|
||||||
var nid = fw * nx + ny;
|
var nid = nx + fw * ny;
|
||||||
|
|
||||||
if (core.isset(route[nid])) continue;
|
if (core.isset(route[nid])) continue;
|
||||||
|
|
||||||
@ -609,18 +609,18 @@ control.prototype.automaticRoute = function (destX, destY) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
route[nid] = direction;
|
route[nid] = direction;
|
||||||
queue.push(tsize*(nowDeep+deepAdd)+nid);
|
queue.push(total*(nowDeep+deepAdd)+nid);
|
||||||
}
|
}
|
||||||
if (core.isset(route[fw * destX + destY])) break;
|
if (core.isset(route[destX + fw * destY])) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!core.isset(route[fw * destX + destY])) {
|
if (!core.isset(route[destX + fw * destY])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var nowX = destX, nowY = destY;
|
var nowX = destX, nowY = destY;
|
||||||
while (nowX != startX || nowY != startY) {
|
while (nowX != startX || nowY != startY) {
|
||||||
var dir = route[fw * nowX + nowY];
|
var dir = route[nowX + fw * nowY];
|
||||||
ans.push({'direction': dir, 'x': nowX, 'y': nowY});
|
ans.push({'direction': dir, 'x': nowX, 'y': nowY});
|
||||||
nowX -= scan[dir].x;
|
nowX -= scan[dir].x;
|
||||||
nowY -= scan[dir].y;
|
nowY -= scan[dir].y;
|
||||||
@ -672,7 +672,7 @@ control.prototype.setHeroMoveInterval = function (direction, x, y, callback) {
|
|||||||
core.setHeroLoc('y', y+scan[direction].y, true);
|
core.setHeroLoc('y', y+scan[direction].y, true);
|
||||||
core.control.updateFollowers();
|
core.control.updateFollowers();
|
||||||
core.moveOneStep();
|
core.moveOneStep();
|
||||||
core.clearMap('hero', 0, 0, 416, 416);
|
core.clearMap('hero');
|
||||||
core.drawHero(direction);
|
core.drawHero(direction);
|
||||||
clearInterval(core.interval.heroMoveInterval);
|
clearInterval(core.interval.heroMoveInterval);
|
||||||
core.status.heroMoving = 0;
|
core.status.heroMoving = 0;
|
||||||
@ -786,7 +786,7 @@ control.prototype.moveHero = function (direction, callback) {
|
|||||||
};
|
};
|
||||||
direction = core.getHeroLoc('direction');
|
direction = core.getHeroLoc('direction');
|
||||||
var nx = core.getHeroLoc('x') + scan[direction].x, ny=core.getHeroLoc('y') + scan[direction].y;
|
var nx = core.getHeroLoc('x') + scan[direction].x, ny=core.getHeroLoc('y') + scan[direction].y;
|
||||||
if (nx<0 || nx>12 || ny<0 || ny>12) return;
|
if (nx<0 || nx>=core.bigmap.width || ny<0 || ny>=core.bigmap.height) return;
|
||||||
|
|
||||||
core.status.heroMoving=-1;
|
core.status.heroMoving=-1;
|
||||||
core.eventMoveHero([direction], 100, function () {
|
core.eventMoveHero([direction], 100, function () {
|
||||||
@ -817,7 +817,7 @@ control.prototype.eventMoveHero = function(steps, time, callback) {
|
|||||||
|
|
||||||
time = time || 100;
|
time = time || 100;
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1.0);
|
core.setAlpha('ui', 1.0);
|
||||||
|
|
||||||
// 要运行的轨迹:将steps展开
|
// 要运行的轨迹:将steps展开
|
||||||
@ -884,7 +884,7 @@ control.prototype.jumpHero = function (ex, ey, time, callback) {
|
|||||||
if (!core.isset(ey)) ey=sy;
|
if (!core.isset(ey)) ey=sy;
|
||||||
|
|
||||||
time = time || 500;
|
time = time || 500;
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1.0);
|
core.setAlpha('ui', 1.0);
|
||||||
core.status.replay.animate=true;
|
core.status.replay.animate=true;
|
||||||
|
|
||||||
@ -991,9 +991,11 @@ control.prototype.setGameCanvasTranslate = function(canvas,x,y){
|
|||||||
c.style.MozTransform='translate('+x+'px,'+y+'px)';
|
c.style.MozTransform='translate('+x+'px,'+y+'px)';
|
||||||
};
|
};
|
||||||
|
|
||||||
////// 更新视野范围
|
////// 更新视野范围 //////
|
||||||
control.prototype.updateViewport = function() {
|
control.prototype.updateViewport = function() {
|
||||||
core.maps.activeCanvas.forEach(function(cn){ core.control.setGameCanvasTranslate(cn,-core.maps.currentOffsetPos.x,-core.maps.currentOffsetPos.y);});
|
core.bigmap.canvas.forEach(function(cn){
|
||||||
|
core.control.setGameCanvasTranslate(cn,-core.bigmap.offsetX,-core.bigmap.offsetY);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 绘制勇士 //////
|
////// 绘制勇士 //////
|
||||||
@ -1015,12 +1017,13 @@ control.prototype.drawHero = function (direction, x, y, status, offset) {
|
|||||||
var offsetX = way.x*offset;
|
var offsetX = way.x*offset;
|
||||||
var offsetY = way.y*offset;
|
var offsetY = way.y*offset;
|
||||||
var dx=offsetX==0?0:offsetX/Math.abs(offsetX), dy=offsetY==0?0:offsetY/Math.abs(offsetY);
|
var dx=offsetX==0?0:offsetX/Math.abs(offsetX), dy=offsetY==0?0:offsetY/Math.abs(offsetY);
|
||||||
core.maps.currentOffsetPos.x = ((x - 6) * 32 + offsetX).clamp(0,416);
|
|
||||||
core.maps.currentOffsetPos.y = ((y - 6) * 32 + offsetY).clamp(0,416);
|
core.bigmap.offsetX = core.clamp((x - 6) * 32 + offsetX, 0, 32*core.bigmap.width-416);
|
||||||
|
core.bigmap.offsetY = core.clamp((y - 6) * 32 + offsetY, 0, 32*core.bigmap.height-416);
|
||||||
|
|
||||||
core.clearAutomaticRouteNode(x+dx, y+dy);
|
core.clearAutomaticRouteNode(x+dx, y+dy);
|
||||||
|
|
||||||
core.canvas.hero.clearRect(x * 32 - core.maps.currentOffsetPos.x - 32, y * 32 - core.maps.currentOffsetPos.y - 32, 96, 96);
|
core.canvas.hero.clearRect(x * 32 - core.bigmap.offsetX - 32, y * 32 - core.bigmap.offsetY - 32, 96, 96);
|
||||||
|
|
||||||
var heroIconArr = core.material.icons.hero;
|
var heroIconArr = core.material.icons.hero;
|
||||||
var drawObjs = [];
|
var drawObjs = [];
|
||||||
@ -1029,8 +1032,8 @@ control.prototype.drawHero = function (direction, x, y, status, offset) {
|
|||||||
"img": core.material.images.hero,
|
"img": core.material.images.hero,
|
||||||
"height": core.material.icons.hero.height,
|
"height": core.material.icons.hero.height,
|
||||||
"heroIcon": heroIconArr[direction],
|
"heroIcon": heroIconArr[direction],
|
||||||
"posx": x * 32 - core.maps.currentOffsetPos.x + offsetX,
|
"posx": x * 32 - core.bigmap.offsetX + offsetX,
|
||||||
"posy": y * 32 - core.maps.currentOffsetPos.y + offsetY,
|
"posy": y * 32 - core.bigmap.offsetY + offsetY,
|
||||||
"status": status,
|
"status": status,
|
||||||
"index": 0,
|
"index": 0,
|
||||||
});
|
});
|
||||||
@ -1045,8 +1048,8 @@ control.prototype.drawHero = function (direction, x, y, status, offset) {
|
|||||||
"img": core.material.images.images[t.img],
|
"img": core.material.images.images[t.img],
|
||||||
"height": core.material.images.images[t.img].height/4,
|
"height": core.material.images.images[t.img].height/4,
|
||||||
"heroIcon": heroIconArr[t.direction],
|
"heroIcon": heroIconArr[t.direction],
|
||||||
"posx": 32*t.x - core.maps.currentOffsetPos.x + (t.stop?0:scan[t.direction].x*offset),
|
"posx": 32*t.x - core.bigmap.offsetX + (t.stop?0:scan[t.direction].x*offset),
|
||||||
"posy": 32*t.y - core.maps.currentOffsetPos.y + (t.stop?0:scan[t.direction].y*offset),
|
"posy": 32*t.y - core.bigmap.offsetY + (t.stop?0:scan[t.direction].y*offset),
|
||||||
"status": t.stop?"stop":status,
|
"status": t.stop?"stop":status,
|
||||||
"index": index++
|
"index": index++
|
||||||
});
|
});
|
||||||
@ -1172,27 +1175,27 @@ control.prototype.updateCheckBlock = function() {
|
|||||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls.indexOf('enemy')==0) {
|
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls.indexOf('enemy')==0) {
|
||||||
var id = block.event.id, enemy = core.material.enemys[id];
|
var id = block.event.id, enemy = core.material.enemys[id];
|
||||||
if (core.isset(enemy)) {
|
if (core.isset(enemy)) {
|
||||||
core.status.checkBlock.map[13*block.x+block.y]=id;
|
core.status.checkBlock.map[block.x+core.bigmap.width*block.y]=id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 血网
|
// 血网
|
||||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) &&
|
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) &&
|
||||||
block.event.id=='lavaNet' && block.event.trigger=='passNet' && !core.hasItem("shoes")) {
|
block.event.id=='lavaNet' && block.event.trigger=='passNet' && !core.hasItem("shoes")) {
|
||||||
core.status.checkBlock.map[13*block.x+block.y]="lavaNet";
|
core.status.checkBlock.map[block.x+core.bigmap.width*block.y]="lavaNet";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step2: 更新领域、阻击伤害
|
// Step2: 更新领域、阻击伤害
|
||||||
core.status.checkBlock.damage = []; // 记录(x,y)点的伤害
|
core.status.checkBlock.damage = []; // 记录(x,y)点的伤害
|
||||||
for (var x=0;x<13*13;x++) core.status.checkBlock.damage[x]=0;
|
for (var x=0;x<core.bigmap.width*core.bigmap.height;x++) core.status.checkBlock.damage[x]=0;
|
||||||
|
|
||||||
for (var x=0;x<13;x++) {
|
for (var x=0;x<core.bigmap.width;x++) {
|
||||||
for (var y=0;y<13;y++) {
|
for (var y=0;y<core.bigmap.height;y++) {
|
||||||
var id = core.status.checkBlock.map[13*x+y];
|
var id = core.status.checkBlock.map[x+core.bigmap.width*y];
|
||||||
if (core.isset(id)) {
|
if (core.isset(id)) {
|
||||||
|
|
||||||
if (id=="lavaNet") {
|
if (id=="lavaNet") {
|
||||||
core.status.checkBlock.damage[13*x+y]+=core.values.lavaDamage;
|
core.status.checkBlock.damage[x+core.bigmap.width*y]+=core.values.lavaDamage;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1206,9 +1209,9 @@ control.prototype.updateCheckBlock = function() {
|
|||||||
for (var dy=-range;dy<=range;dy++) {
|
for (var dy=-range;dy<=range;dy++) {
|
||||||
if (dx==0 && dy==0) continue;
|
if (dx==0 && dy==0) continue;
|
||||||
var nx=x+dx, ny=y+dy;
|
var nx=x+dx, ny=y+dy;
|
||||||
if (nx<0 || nx>12 || ny<0 || ny>12) continue;
|
if (nx<0 || nx>=core.bigmap.width || ny<0 || ny>=core.bigmap.height) continue;
|
||||||
if (!zoneSquare && Math.abs(dx)+Math.abs(dy)>range) continue;
|
if (!zoneSquare && Math.abs(dx)+Math.abs(dy)>range) continue;
|
||||||
core.status.checkBlock.damage[13*nx+ny]+=enemy.value;
|
core.status.checkBlock.damage[nx+ny*core.bigmap.width]+=enemy.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1218,8 +1221,8 @@ control.prototype.updateCheckBlock = function() {
|
|||||||
for (var dy=-1;dy<=1;dy++) {
|
for (var dy=-1;dy<=1;dy++) {
|
||||||
if (dx==0 && dy==0) continue;
|
if (dx==0 && dy==0) continue;
|
||||||
var nx=x+dx, ny=y+dy;
|
var nx=x+dx, ny=y+dy;
|
||||||
if (nx<0 || nx>12 || ny<0 || ny>12 || Math.abs(dx)+Math.abs(dy)>1) continue;
|
if (nx<0 || nx>=core.bigmap.width || ny<0 || ny>=core.bigmap.height || Math.abs(dx)+Math.abs(dy)>1) continue;
|
||||||
core.status.checkBlock.damage[13*nx+ny]+=enemy.value;
|
core.status.checkBlock.damage[nx+ny*core.bigmap.width]+=enemy.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1230,12 +1233,12 @@ control.prototype.updateCheckBlock = function() {
|
|||||||
|
|
||||||
// Step3: 更新夹击点坐标,并将夹击伤害加入到damage中
|
// Step3: 更新夹击点坐标,并将夹击伤害加入到damage中
|
||||||
core.status.checkBlock.betweenAttack = []; // 记录(x,y)点是否有夹击
|
core.status.checkBlock.betweenAttack = []; // 记录(x,y)点是否有夹击
|
||||||
for (var x=0;x<13;x++) {
|
for (var x=0;x<core.bigmap.width;x++) {
|
||||||
for (var y=0;y<13;y++) {
|
for (var y=0;y<core.bigmap.height;y++) {
|
||||||
var has=false;
|
var has=false;
|
||||||
if (x>0 && x<12) {
|
if (x>0 && x<core.bigmap.width-1) {
|
||||||
var id1=core.status.checkBlock.map[13*(x-1)+y],
|
var id1=core.status.checkBlock.map[x-1+core.bigmap.width*y],
|
||||||
id2=core.status.checkBlock.map[13*(x+1)+y];
|
id2=core.status.checkBlock.map[x+1+core.bigmap.height*y];
|
||||||
if (core.isset(id1) && core.isset(id2) && id1==id2) {
|
if (core.isset(id1) && core.isset(id2) && id1==id2) {
|
||||||
var enemy = core.material.enemys[id1];
|
var enemy = core.material.enemys[id1];
|
||||||
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
|
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
|
||||||
@ -1243,9 +1246,9 @@ control.prototype.updateCheckBlock = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (y>0 && y<12) {
|
if (y>0 && y<core.bigmap.height-1) {
|
||||||
var id1=core.status.checkBlock.map[13*x+y-1],
|
var id1=core.status.checkBlock.map[x+core.bigmap.width*(y-1)],
|
||||||
id2=core.status.checkBlock.map[13*x+y+1];
|
id2=core.status.checkBlock.map[x+core.bigmap.width*(y+1)];
|
||||||
if (core.isset(id1) && core.isset(id2) && id1==id2) {
|
if (core.isset(id1) && core.isset(id2) && id1==id2) {
|
||||||
var enemy = core.material.enemys[id1];
|
var enemy = core.material.enemys[id1];
|
||||||
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
|
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
|
||||||
@ -1255,10 +1258,10 @@ control.prototype.updateCheckBlock = function() {
|
|||||||
}
|
}
|
||||||
// 存在夹击
|
// 存在夹击
|
||||||
if (has) {
|
if (has) {
|
||||||
core.status.checkBlock.betweenAttack[13*x+y]=true;
|
core.status.checkBlock.betweenAttack[x+core.bigmap.width*y]=true;
|
||||||
var leftHp = core.status.hero.hp - core.status.checkBlock.damage[13*x+y];
|
var leftHp = core.status.hero.hp - core.status.checkBlock.damage[x+core.bigmap.width*y];
|
||||||
if (leftHp>1)
|
if (leftHp>1)
|
||||||
core.status.checkBlock.damage[13*x+y] += Math.floor((leftHp+(core.flags.betweenAttackCeil?0:1))/2);
|
core.status.checkBlock.damage[x+core.bigmap.width*y] += Math.floor((leftHp+(core.flags.betweenAttackCeil?0:1))/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1267,7 +1270,7 @@ control.prototype.updateCheckBlock = function() {
|
|||||||
////// 检查并执行领域、夹击、阻击事件 //////
|
////// 检查并执行领域、夹击、阻击事件 //////
|
||||||
control.prototype.checkBlock = function () {
|
control.prototype.checkBlock = function () {
|
||||||
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y');
|
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y');
|
||||||
var damage = core.status.checkBlock.damage[13*x+y];
|
var damage = core.status.checkBlock.damage[x+core.bigmap.width*y];
|
||||||
if (damage>0) {
|
if (damage>0) {
|
||||||
core.status.hero.hp -= damage;
|
core.status.hero.hp -= damage;
|
||||||
|
|
||||||
@ -1281,8 +1284,8 @@ control.prototype.checkBlock = function () {
|
|||||||
}
|
}
|
||||||
for (var direction in scan) {
|
for (var direction in scan) {
|
||||||
var nx = x+scan[direction].x, ny=y+scan[direction].y;
|
var nx = x+scan[direction].x, ny=y+scan[direction].y;
|
||||||
if (nx<0 || nx>12 || ny<0 || ny>12) continue;
|
if (nx<0 || nx>=core.bigmap.width || ny<0 || ny>=core.bigmap.height) continue;
|
||||||
var id=core.status.checkBlock.map[13*nx+ny];
|
var id=core.status.checkBlock.map[nx+core.bigmap.width*ny];
|
||||||
if (core.isset(id)) {
|
if (core.isset(id)) {
|
||||||
var enemy = core.material.enemys[id];
|
var enemy = core.material.enemys[id];
|
||||||
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 18)) {
|
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 18)) {
|
||||||
@ -1291,10 +1294,10 @@ control.prototype.checkBlock = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (core.status.checkBlock.betweenAttack[13*x+y] && damage>0) {
|
if (core.status.checkBlock.betweenAttack[x+core.bigmap.width*y] && damage>0) {
|
||||||
core.drawTip('受到夹击,生命变成一半');
|
core.drawTip('受到夹击,生命变成一半');
|
||||||
}
|
}
|
||||||
else if (core.status.checkBlock.map[13*x+y]=='lavaNet') {
|
else if (core.status.checkBlock.map[x+core.bigmap.width*y]=='lavaNet') {
|
||||||
core.drawTip('受到血网伤害'+damage+'点');
|
core.drawTip('受到血网伤害'+damage+'点');
|
||||||
}
|
}
|
||||||
// 阻击
|
// 阻击
|
||||||
@ -1321,7 +1324,7 @@ control.prototype.checkBlock = function () {
|
|||||||
var x=t.x, y=t.y, direction = t.direction;
|
var x=t.x, y=t.y, direction = t.direction;
|
||||||
var nx = x+scan[direction].x, ny=y+scan[direction].y;
|
var nx = x+scan[direction].x, ny=y+scan[direction].y;
|
||||||
|
|
||||||
return nx>=0 && nx<=12 && ny>=0 && ny<=12 && core.getBlock(nx, ny, core.status.floorId, false)==null;
|
return nx>=0 && nx<core.bigmap.width && ny>=0 && ny<core.bigmap.height && core.getBlock(nx, ny, core.status.floorId, false)==null;
|
||||||
});
|
});
|
||||||
core.updateStatusBar();
|
core.updateStatusBar();
|
||||||
if (snipe.length>0)
|
if (snipe.length>0)
|
||||||
@ -1461,7 +1464,7 @@ control.prototype.setWeather = function (type, level) {
|
|||||||
|
|
||||||
// 非雨雪
|
// 非雨雪
|
||||||
if (type!='rain' && type!='snow') {
|
if (type!='rain' && type!='snow') {
|
||||||
core.clearMap('weather', 0, 0, 416, 416)
|
core.clearMap('weather')
|
||||||
core.animateFrame.weather.type = null;
|
core.animateFrame.weather.type = null;
|
||||||
core.animateFrame.weather.level = 0;
|
core.animateFrame.weather.level = 0;
|
||||||
core.animateFrame.weather.nodes = [];
|
core.animateFrame.weather.nodes = [];
|
||||||
@ -1480,7 +1483,7 @@ control.prototype.setWeather = function (type, level) {
|
|||||||
if (level<1) level=1; if (level>10) level=10;
|
if (level<1) level=1; if (level>10) level=10;
|
||||||
level *= 20;
|
level *= 20;
|
||||||
|
|
||||||
core.clearMap('weather', 0, 0, 416, 416)
|
core.clearMap('weather')
|
||||||
core.animateFrame.weather.type = type;
|
core.animateFrame.weather.type = type;
|
||||||
core.animateFrame.weather.level = level;
|
core.animateFrame.weather.level = level;
|
||||||
|
|
||||||
@ -1563,7 +1566,7 @@ control.prototype.updateFg = function () {
|
|||||||
if (!core.isset(core.status.thisMap) || !core.isset(core.status.thisMap.blocks)) return;
|
if (!core.isset(core.status.thisMap) || !core.isset(core.status.thisMap.blocks)) return;
|
||||||
// 更新显伤
|
// 更新显伤
|
||||||
var mapBlocks = core.status.thisMap.blocks;
|
var mapBlocks = core.status.thisMap.blocks;
|
||||||
core.clearMap('fg', 0, 0, 416, 416);
|
core.clearMap('fg');
|
||||||
// 没有怪物手册
|
// 没有怪物手册
|
||||||
if (!core.hasItem('book')) return;
|
if (!core.hasItem('book')) return;
|
||||||
core.setFont('fg', "bold 11px Arial");
|
core.setFont('fg', "bold 11px Arial");
|
||||||
@ -1637,9 +1640,9 @@ control.prototype.updateFg = function () {
|
|||||||
// 如果是领域&夹击
|
// 如果是领域&夹击
|
||||||
if (core.flags.displayExtraDamage) {
|
if (core.flags.displayExtraDamage) {
|
||||||
core.canvas.fg.textAlign = 'center';
|
core.canvas.fg.textAlign = 'center';
|
||||||
for (var x=0;x<13;x++) {
|
for (var x=0;x<core.bigmap.width;x++) {
|
||||||
for (var y=0;y<13;y++) {
|
for (var y=0;y<core.bigmap.height;y++) {
|
||||||
var damage = core.status.checkBlock.damage[13*x+y];
|
var damage = core.status.checkBlock.damage[x+core.bigmap.width*y];
|
||||||
if (damage>0) {
|
if (damage>0) {
|
||||||
damage = core.formatBigNumber(damage);
|
damage = core.formatBigNumber(damage);
|
||||||
core.setFillStyle('fg', '#000000');
|
core.setFillStyle('fg', '#000000');
|
||||||
@ -2814,16 +2817,6 @@ control.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
left: (clientWidth-gameGroupWidth)/2 + unit,
|
left: (clientWidth-gameGroupWidth)/2 + unit,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
className: 'gameCanvas',
|
|
||||||
rules:{
|
|
||||||
// width: canvasWidth + unit,
|
|
||||||
// height: canvasWidth + unit,
|
|
||||||
top: canvasTop + unit,
|
|
||||||
left: 0,
|
|
||||||
border: '3px '+borderColor+' solid',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: 'gif',
|
id: 'gif',
|
||||||
rules: {
|
rules: {
|
||||||
@ -2857,7 +2850,7 @@ control.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
width: (canvasWidth - SPACE*2) + unit,
|
width: (canvasWidth - SPACE*2) + unit,
|
||||||
height:(canvasWidth - SPACE*2) + unit,
|
height:(canvasWidth - SPACE*2) + unit,
|
||||||
top: canvasTop + unit,
|
top: canvasTop + unit,
|
||||||
right: SPACE + unit,
|
right: 0,
|
||||||
border: '3px #fff solid'
|
border: '3px #fff solid'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
11
libs/core.js
11
libs/core.js
@ -76,6 +76,13 @@ function core() {
|
|||||||
styles: [],
|
styles: [],
|
||||||
scale: 1.0,
|
scale: 1.0,
|
||||||
}
|
}
|
||||||
|
this.bigmap = {
|
||||||
|
canvas: ["bg", "event", "event2", "fg"],
|
||||||
|
offsetX: 0, // in pixel
|
||||||
|
offsetY: 0,
|
||||||
|
width: 13, // map width and height
|
||||||
|
height: 13
|
||||||
|
}
|
||||||
this.initStatus = {
|
this.initStatus = {
|
||||||
'played': false,
|
'played': false,
|
||||||
'gameOver': false,
|
'gameOver': false,
|
||||||
@ -1146,6 +1153,10 @@ core.prototype.subarray = function (a, b) {
|
|||||||
return core.utils.subarray(a, b);
|
return core.utils.subarray(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
core.prototype.clamp = function (x, a, b) {
|
||||||
|
return core.utils.clamp(x, a, b);
|
||||||
|
}
|
||||||
|
|
||||||
////// Base64加密 //////
|
////// Base64加密 //////
|
||||||
core.prototype.encodeBase64 = function (str) {
|
core.prototype.encodeBase64 = function (str) {
|
||||||
return core.utils.encodeBase64(str);
|
return core.utils.encodeBase64(str);
|
||||||
|
|||||||
@ -131,9 +131,9 @@ events.prototype.lose = function (reason) {
|
|||||||
events.prototype.gameOver = function (ending, fromReplay, norank) {
|
events.prototype.gameOver = function (ending, fromReplay, norank) {
|
||||||
|
|
||||||
// 清空图片和天气
|
// 清空图片和天气
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('animate');
|
||||||
core.dom.gif2.innerHTML = "";
|
core.dom.gif2.innerHTML = "";
|
||||||
core.clearMap('weather', 0, 0, 416, 416)
|
core.clearMap('weather')
|
||||||
core.animateFrame.weather.type = null;
|
core.animateFrame.weather.type = null;
|
||||||
core.animateFrame.weather.level = 0;
|
core.animateFrame.weather.level = 0;
|
||||||
core.animateFrame.weather.nodes = [];
|
core.animateFrame.weather.nodes = [];
|
||||||
@ -281,7 +281,7 @@ events.prototype.doAction = function() {
|
|||||||
core.status.boxAnimateObjs = [];
|
core.status.boxAnimateObjs = [];
|
||||||
clearInterval(core.status.event.interval);
|
clearInterval(core.status.event.interval);
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1.0);
|
core.setAlpha('ui', 1.0);
|
||||||
|
|
||||||
// 事件处理完毕
|
// 事件处理完毕
|
||||||
@ -513,7 +513,7 @@ events.prototype.doAction = function() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "changePos": // 直接更换勇士位置,不切换楼层
|
case "changePos": // 直接更换勇士位置,不切换楼层
|
||||||
core.clearMap('hero', 0, 0, 416, 416);
|
core.clearMap('hero');
|
||||||
if (core.isset(data.loc)) {
|
if (core.isset(data.loc)) {
|
||||||
core.setHeroLoc('x', core.calValue(data.loc[0]));
|
core.setHeroLoc('x', core.calValue(data.loc[0]));
|
||||||
core.setHeroLoc('y', core.calValue(data.loc[1]));
|
core.setHeroLoc('y', core.calValue(data.loc[1]));
|
||||||
@ -527,7 +527,7 @@ events.prototype.doAction = function() {
|
|||||||
core.canvas.animate.drawImage(core.material.images.images[data.name],
|
core.canvas.animate.drawImage(core.material.images.images[data.name],
|
||||||
core.calValue(data.loc[0]), core.calValue(data.loc[1]));
|
core.calValue(data.loc[0]), core.calValue(data.loc[1]));
|
||||||
}
|
}
|
||||||
else core.clearMap('animate', 0, 0, 416, 416);
|
else core.clearMap('animate');
|
||||||
this.doAction();
|
this.doAction();
|
||||||
break;
|
break;
|
||||||
case "animateImage": // 淡入淡出图片
|
case "animateImage": // 淡入淡出图片
|
||||||
@ -1186,14 +1186,14 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 重置画布尺寸
|
// 重置画布尺寸
|
||||||
core.maps.resizeCanvas(floorId);
|
core.maps.resizeMap(floorId);
|
||||||
// 画地图
|
// 画地图
|
||||||
core.drawMap(floorId, function () {
|
core.drawMap(floorId, function () {
|
||||||
if (core.isset(heroLoc.direction))
|
if (core.isset(heroLoc.direction))
|
||||||
core.setHeroLoc('direction', heroLoc.direction);
|
core.setHeroLoc('direction', heroLoc.direction);
|
||||||
core.setHeroLoc('x', heroLoc.x);
|
core.setHeroLoc('x', heroLoc.x);
|
||||||
core.setHeroLoc('y', heroLoc.y);
|
core.setHeroLoc('y', heroLoc.y);
|
||||||
core.clearMap('hero', 0, 0, 416, 416);
|
core.clearMap('hero');
|
||||||
core.drawHero();
|
core.drawHero();
|
||||||
|
|
||||||
var changed = function () {
|
var changed = function () {
|
||||||
@ -1247,7 +1247,7 @@ events.prototype.animateImage = function (type, image, loc, time, callback) {
|
|||||||
core.setOpacity('data', opacityVal);
|
core.setOpacity('data', opacityVal);
|
||||||
if (opacityVal >=1 || opacityVal<=0) {
|
if (opacityVal >=1 || opacityVal<=0) {
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
core.setOpacity('data', 1);
|
core.setOpacity('data', 1);
|
||||||
core.status.replay.animate=false;
|
core.status.replay.animate=false;
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
@ -1267,7 +1267,7 @@ events.prototype.moveImage = function (image, from, to, time, callback) {
|
|||||||
toX = core.calValue(to[0]), toY = core.calValue(to[1]);
|
toX = core.calValue(to[0]), toY = core.calValue(to[1]);
|
||||||
var step = 0;
|
var step = 0;
|
||||||
var drawImage = function () {
|
var drawImage = function () {
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
var nowX = parseInt(fromX + (toX-fromX)*step/64);
|
var nowX = parseInt(fromX + (toX-fromX)*step/64);
|
||||||
var nowY = parseInt(fromY + (toY-fromY)*step/64);
|
var nowY = parseInt(fromY + (toY-fromY)*step/64);
|
||||||
core.canvas.data.drawImage(image, nowX, nowY);
|
core.canvas.data.drawImage(image, nowX, nowY);
|
||||||
@ -1279,7 +1279,7 @@ events.prototype.moveImage = function (image, from, to, time, callback) {
|
|||||||
drawImage();
|
drawImage();
|
||||||
if (step>=64) {
|
if (step>=64) {
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
core.status.replay.animate=false;
|
core.status.replay.animate=false;
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
}
|
}
|
||||||
@ -1610,7 +1610,7 @@ events.prototype.pushBox = function (data) {
|
|||||||
|
|
||||||
var direction = core.getHeroLoc('direction'), nx=data.x+scan[direction].x, ny=data.y+scan[direction].y;
|
var direction = core.getHeroLoc('direction'), nx=data.x+scan[direction].x, ny=data.y+scan[direction].y;
|
||||||
|
|
||||||
if (nx<0||nx>12||ny<0||ny>12) return;
|
if (nx<0||nx>=core.bigmap.width||ny<0||ny>=core.bigmap.height) return;
|
||||||
|
|
||||||
var block = core.getBlock(nx, ny, null, false);
|
var block = core.getBlock(nx, ny, null, false);
|
||||||
if (block!=null && !(core.isset(block.block.event) && block.block.event.id=='flower'))
|
if (block!=null && !(core.isset(block.block.event) && block.block.event.id=='flower'))
|
||||||
|
|||||||
95
libs/maps.js
95
libs/maps.js
@ -18,11 +18,11 @@ maps.prototype.loadFloor = function (floorId, map) {
|
|||||||
if (!core.isset(map)) map=floor.map;
|
if (!core.isset(map)) map=floor.map;
|
||||||
var mapIntoBlocks = function(map,maps,floor){
|
var mapIntoBlocks = function(map,maps,floor){
|
||||||
var blocks = [];
|
var blocks = [];
|
||||||
var mw = core.floors[floorId].tileWidth;
|
var mw = core.floors[floorId].width || 13;
|
||||||
var mh = core.floors[floorId].tileHeight;
|
var mh = core.floors[floorId].height || 13;
|
||||||
for (var i = 0; i < mh; i++) {
|
for (var i = 0; i < mh; i++) {
|
||||||
for (var j = 0; j < mw; j++) {
|
for (var j = 0; j < mw; j++) {
|
||||||
var block = maps.initBlock(j, i, map[i][j]);
|
var block = maps.initBlock(j, i, (map[i]||[])[j]||0);
|
||||||
maps.addInfo(block);
|
maps.addInfo(block);
|
||||||
maps.addEvent(block,j,i,floor.events[j+","+i])
|
maps.addEvent(block,j,i,floor.events[j+","+i])
|
||||||
maps.addChangeFloor(block,j,i,floor.changeFloor[j+","+i]);
|
maps.addChangeFloor(block,j,i,floor.changeFloor[j+","+i]);
|
||||||
@ -160,8 +160,8 @@ maps.prototype.save = function(maps, floorId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var thisFloor = maps[floorId];
|
var thisFloor = maps[floorId];
|
||||||
var mw = core.floors[floorId].tileWidth;
|
var mw = core.floors[floorId].width || 13;
|
||||||
var mh = core.floors[floorId].tileHeight;
|
var mh = core.floors[floorId].height || 13;
|
||||||
|
|
||||||
var blocks = [];
|
var blocks = [];
|
||||||
for (var x=0;x<mw;x++) {
|
for (var x=0;x<mw;x++) {
|
||||||
@ -180,16 +180,14 @@ maps.prototype.save = function(maps, floorId) {
|
|||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 需要更改尺寸的画布
|
|
||||||
maps.prototype.activeCanvas = ['bg','event','event2'];
|
|
||||||
////// 记忆偏移量
|
|
||||||
maps.prototype.currentOffsetPos = {x :0 ,y :0};
|
|
||||||
|
|
||||||
////// 更改地图画布的尺寸
|
////// 更改地图画布的尺寸
|
||||||
maps.prototype.resizeCanvas = function(floorId) {
|
maps.prototype.resizeMap = function(floorId) {
|
||||||
var cwidth = core.floors[floorId].tileWidth * 32;
|
floorId = floorId || core.status.floorId;
|
||||||
var cheight = core.floors[floorId].tileHeight * 32;
|
core.bigmap.width = core.floors[floorId].width || 13;
|
||||||
this.activeCanvas.forEach(function(cn){
|
core.bigmap.height = core.floors[floorId].height || 13;
|
||||||
|
var cwidth = core.bigmap.width * 32;
|
||||||
|
var cheight = core.bigmap.height * 32;
|
||||||
|
core.bigmap.canvas.forEach(function(cn){
|
||||||
core.canvas[cn].canvas.setAttribute("width",cwidth);
|
core.canvas[cn].canvas.setAttribute("width",cwidth);
|
||||||
core.canvas[cn].canvas.setAttribute("height",cheight);
|
core.canvas[cn].canvas.setAttribute("height",cheight);
|
||||||
core.canvas[cn].canvas.style.width = cwidth;
|
core.canvas[cn].canvas.style.width = cwidth;
|
||||||
@ -274,7 +272,7 @@ maps.prototype.canMoveHero = function(x,y,direction,floorId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 检查将死的领域
|
// 检查将死的领域
|
||||||
if (core.status.hero.hp <= core.status.checkBlock.damage[13*nx+ny] && !core.flags.canGoDeadZone)
|
if (core.status.hero.hp <= core.status.checkBlock.damage[nx+core.bigmap.width*ny] && !core.flags.canGoDeadZone)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -295,24 +293,24 @@ maps.prototype.canMoveDirectly = function (destX,destY) {
|
|||||||
// 可以无视起点事件
|
// 可以无视起点事件
|
||||||
var nowBlockId = core.getBlockId(fromX, fromY);
|
var nowBlockId = core.getBlockId(fromX, fromY);
|
||||||
if ((nowBlockId!=null&&nowBlockId!='upFloor'&&nowBlockId!='downFloor')
|
if ((nowBlockId!=null&&nowBlockId!='upFloor'&&nowBlockId!='downFloor')
|
||||||
||core.status.checkBlock.damage[13*fromX+fromY]>0)
|
||core.status.checkBlock.damage[fromX+core.bigmap.width*fromY]>0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// BFS
|
// BFS
|
||||||
var visited=[], queue=[];
|
var visited=[], queue=[];
|
||||||
visited[13*fromX+fromY]=0;
|
visited[fromX+core.bigmap.width*fromY]=0;
|
||||||
queue.push(13*fromX+fromY);
|
queue.push(fromX+core.bigmap.width*fromY);
|
||||||
|
|
||||||
var directions = [[-1,0],[1,0],[0,1],[0,-1]];
|
var directions = [[-1,0],[1,0],[0,1],[0,-1]];
|
||||||
while (queue.length>0) {
|
while (queue.length>0) {
|
||||||
var now=queue.shift(), nowX=parseInt(now/13), nowY=now%13;
|
var now=queue.shift(), nowX=parseInt(now%core.bigmap.width), nowY=parseInt(now/core.bigmap.width);
|
||||||
|
|
||||||
for (var dir in directions) {
|
for (var dir in directions) {
|
||||||
var nx=nowX+directions[dir][0], ny=nowY+directions[dir][1];
|
var nx=nowX+directions[dir][0], ny=nowY+directions[dir][1];
|
||||||
if (nx<0||nx>=13||ny<0||ny>=13||visited[13*nx+ny]||core.getBlock(nx,ny)!=null||core.status.checkBlock.damage[13*nx+ny]>0) continue;
|
if (nx<0||nx>=core.bigmap.width||ny<0||ny>=core.bigmap.height||visited[nx+core.bigmap.width*ny]||core.getBlock(nx,ny)!=null||core.status.checkBlock.damage[nx+core.bigmap.width*ny]>0) continue;
|
||||||
visited[13*nx+ny]=visited[13*nowX+nowY]+1;
|
visited[nx+core.bigmap.width*ny]=visited[nowX+core.bigmap.width*nowY]+1;
|
||||||
if (nx==destX&&ny==destY) return visited[13*nx+ny];
|
if (nx==destX&&ny==destY) return visited[nx+core.bigmap.width*ny];
|
||||||
queue.push(13*nx+ny);
|
queue.push(nx+core.bigmap.width*ny);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@ -337,17 +335,13 @@ maps.prototype.drawBlock = function (block, animate, dx, dy) {
|
|||||||
maps.prototype.drawMap = function (mapName, callback) {
|
maps.prototype.drawMap = function (mapName, callback) {
|
||||||
core.clearMap('all');
|
core.clearMap('all');
|
||||||
core.removeGlobalAnimate(null, null, true);
|
core.removeGlobalAnimate(null, null, true);
|
||||||
var mw = core.floors[mapName].tileWidth;
|
|
||||||
var mh = core.floors[mapName].tileHeight;
|
|
||||||
var drawBg = function(){
|
var drawBg = function(){
|
||||||
var groundId = core.floors[mapName].defaultGround || "ground";
|
var groundId = core.floors[mapName].defaultGround || "ground";
|
||||||
var blockIcon = core.material.icons.terrains[groundId];
|
var blockIcon = core.material.icons.terrains[groundId];
|
||||||
var blockImage = core.material.images.terrains;
|
var blockImage = core.material.images.terrains;
|
||||||
var dx = core.getHeroLoc('x');
|
|
||||||
var dy = core.getHeroLoc('y');
|
|
||||||
|
|
||||||
for (var x = 0; x < mw; x++) {
|
for (var x = 0; x < core.bigmap.width; x++) {
|
||||||
for (var y = 0; y < mh; y++) {
|
for (var y = 0; y < core.bigmap.height; y++) {
|
||||||
core.canvas.bg.drawImage(blockImage, 0, blockIcon * 32, 32, 32, x * 32, y * 32, 32, 32);
|
core.canvas.bg.drawImage(blockImage, 0, blockIcon * 32, 32, 32, x * 32, y * 32, 32, 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -395,7 +389,7 @@ maps.prototype.drawMap = function (mapName, callback) {
|
|||||||
}
|
}
|
||||||
if (main.mode=='editor'){
|
if (main.mode=='editor'){
|
||||||
main.editor.drawMapBg = function(){
|
main.editor.drawMapBg = function(){
|
||||||
core.clearMap('bg', 0, 0, 416, 416);
|
core.clearMap('bg');
|
||||||
drawBg();
|
drawBg();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -408,7 +402,7 @@ maps.prototype.drawMap = function (mapName, callback) {
|
|||||||
var mapData = core.status.maps[core.status.floorId];
|
var mapData = core.status.maps[core.status.floorId];
|
||||||
var mapBlocks = mapData.blocks;
|
var mapBlocks = mapData.blocks;
|
||||||
|
|
||||||
var mapArray = core.maps.getMapArray(mapBlocks,mw,mh);
|
var mapArray = core.maps.getMapArray(mapBlocks,core.bigmap.width,core.bigmap.height);
|
||||||
for (var b = 0; b < mapBlocks.length; b++) {
|
for (var b = 0; b < mapBlocks.length; b++) {
|
||||||
// 事件启用
|
// 事件启用
|
||||||
var block = mapBlocks[b];
|
var block = mapBlocks[b];
|
||||||
@ -429,9 +423,9 @@ maps.prototype.drawMap = function (mapName, callback) {
|
|||||||
if (main.mode=='editor'){
|
if (main.mode=='editor'){
|
||||||
main.editor.updateMap = function(){
|
main.editor.updateMap = function(){
|
||||||
core.removeGlobalAnimate(null, null, true);
|
core.removeGlobalAnimate(null, null, true);
|
||||||
core.clearMap('bg', 0, 0, 416, 416);
|
core.clearMap('bg');
|
||||||
core.clearMap('event', 0, 0, 416, 416);
|
core.clearMap('event');
|
||||||
core.clearMap('event2', 0, 0, 416, 416);
|
core.clearMap('event2');
|
||||||
drawBg();
|
drawBg();
|
||||||
drawEvent();
|
drawEvent();
|
||||||
core.setGlobalAnimate(core.values.animateSpeed);
|
core.setGlobalAnimate(core.values.animateSpeed);
|
||||||
@ -473,7 +467,7 @@ maps.prototype.drawAutotile = function(ctx, mapArr, block, size, left, top){
|
|||||||
ctx.drawImage(autotileImg, sx, sy, 16, 16, dx, dy, size/2, size/2);
|
ctx.drawImage(autotileImg, sx, sy, 16, 16, dx, dy, size/2, size/2);
|
||||||
}
|
}
|
||||||
var getAutotileAroundId = function(currId, x, y){
|
var getAutotileAroundId = function(currId, x, y){
|
||||||
if(x<0 || y<0 || x>12 || y>12) return 1;
|
if(x<0 || y<0 || x>=core.bigmap.width || y>=core.bigmap.height) return 1;
|
||||||
else return mapArr[y][x]==currId ? 1:0;
|
else return mapArr[y][x]==currId ? 1:0;
|
||||||
}
|
}
|
||||||
var checkAround = function(x, y){ // 得到周围四个32*32块(周围每块都包含当前块的1/4,不清楚的话画下图你就明白)的数组索引
|
var checkAround = function(x, y){ // 得到周围四个32*32块(周围每块都包含当前块的1/4,不清楚的话画下图你就明白)的数组索引
|
||||||
@ -537,8 +531,7 @@ maps.prototype.noPassExists = function (x, y, floorId) {
|
|||||||
|
|
||||||
////// 某个点是否在区域内且不可通行 //////
|
////// 某个点是否在区域内且不可通行 //////
|
||||||
maps.prototype.noPass = function (x, y) {
|
maps.prototype.noPass = function (x, y) {
|
||||||
var floor = core.floors[core.status.floorId];
|
return x<0 || x>=core.bigmap.width || y<0 || y>=core.bigmap.height || this.noPassExists(x,y);
|
||||||
return x<0 || x>=floor.tileWidth || y<0 || y>=floor.tileHeight || this.noPassExists(x,y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 某个点是否存在NPC //////
|
////// 某个点是否存在NPC //////
|
||||||
@ -601,7 +594,7 @@ maps.prototype.getBlockId = function (x, y, floorId, needEnable) {
|
|||||||
maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
||||||
time = time || 500;
|
time = time || 500;
|
||||||
|
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('animate');
|
||||||
|
|
||||||
var block = core.getBlock(x,y);
|
var block = core.getBlock(x,y);
|
||||||
if (block==null) {// 不存在
|
if (block==null) {// 不存在
|
||||||
@ -615,7 +608,7 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
|||||||
// 需要删除该块
|
// 需要删除该块
|
||||||
core.removeBlock(x,y);
|
core.removeBlock(x,y);
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1.0);
|
core.setAlpha('ui', 1.0);
|
||||||
|
|
||||||
block=block.block;
|
block=block.block;
|
||||||
@ -675,7 +668,7 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
|||||||
core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, nowX, nowY-height+32, 32, height);
|
core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, nowX, nowY-height+32, 32, height);
|
||||||
if (opacityVal<=0) {
|
if (opacityVal<=0) {
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('animate');
|
||||||
core.setOpacity('animate', 1);
|
core.setOpacity('animate', 1);
|
||||||
// 不消失
|
// 不消失
|
||||||
if (keep) {
|
if (keep) {
|
||||||
@ -706,7 +699,7 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
|||||||
////// 显示跳跃某块的动画,达到{"type":"jump"}的效果 //////
|
////// 显示跳跃某块的动画,达到{"type":"jump"}的效果 //////
|
||||||
maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
||||||
time = time || 500;
|
time = time || 500;
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('animate');
|
||||||
var block = core.getBlock(sx,sy);
|
var block = core.getBlock(sx,sy);
|
||||||
if (block==null) {
|
if (block==null) {
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
@ -718,7 +711,7 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
|||||||
|
|
||||||
// 需要删除该块
|
// 需要删除该块
|
||||||
core.removeBlock(sx,sy);
|
core.removeBlock(sx,sy);
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1.0);
|
core.setAlpha('ui', 1.0);
|
||||||
|
|
||||||
block=block.block;
|
block=block.block;
|
||||||
@ -781,7 +774,7 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
|||||||
core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, drawX(), drawY()-height+32, 32, height);
|
core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, drawX(), drawY()-height+32, 32, height);
|
||||||
if (opacityVal<=0) {
|
if (opacityVal<=0) {
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('animate');
|
||||||
core.setOpacity('animate', 1);
|
core.setOpacity('animate', 1);
|
||||||
if (keep) {
|
if (keep) {
|
||||||
core.setBlock(id, ex, ey);
|
core.setBlock(id, ex, ey);
|
||||||
@ -799,7 +792,7 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
|||||||
maps.prototype.animateBlock = function (loc,type,time,callback) {
|
maps.prototype.animateBlock = function (loc,type,time,callback) {
|
||||||
if (type!='hide') type='show';
|
if (type!='hide') type='show';
|
||||||
|
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('animate');
|
||||||
|
|
||||||
if (typeof loc[0] == 'number' && typeof loc[1] == 'number')
|
if (typeof loc[0] == 'number' && typeof loc[1] == 'number')
|
||||||
loc = [loc];
|
loc = [loc];
|
||||||
@ -840,7 +833,7 @@ maps.prototype.animateBlock = function (loc,type,time,callback) {
|
|||||||
core.setOpacity('animate', opacityVal);
|
core.setOpacity('animate', opacityVal);
|
||||||
if (opacityVal >=1 || opacityVal<=0) {
|
if (opacityVal >=1 || opacityVal<=0) {
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('animate');
|
||||||
core.setOpacity('animate', 1);
|
core.setOpacity('animate', 1);
|
||||||
core.status.replay.animate=false;
|
core.status.replay.animate=false;
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
@ -927,7 +920,7 @@ maps.prototype.removeBlockByIds = function (floorId, ids) {
|
|||||||
maps.prototype.setBlock = function (number, x, y, floorId) {
|
maps.prototype.setBlock = function (number, x, y, floorId) {
|
||||||
floorId = floorId || core.status.floorId;
|
floorId = floorId || core.status.floorId;
|
||||||
if (!core.isset(number) || !core.isset(x) || !core.isset(y)) return;
|
if (!core.isset(number) || !core.isset(x) || !core.isset(y)) return;
|
||||||
if (x<0 || x>12 || y<0 || y>12) return;
|
if (x<0 || x>=core.bigmap.width || y<0 || y>=core.bigmap.height) return;
|
||||||
|
|
||||||
var originBlock=core.getBlock(x,y,floorId,false);
|
var originBlock=core.getBlock(x,y,floorId,false);
|
||||||
var block = core.maps.initBlock(x,y,number);
|
var block = core.maps.initBlock(x,y,number);
|
||||||
@ -1021,7 +1014,7 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
|
|||||||
|
|
||||||
// 清空animate层
|
// 清空animate层
|
||||||
clearInterval(core.interval.animateInterval);
|
clearInterval(core.interval.animateInterval);
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('animate');
|
||||||
|
|
||||||
// 开始绘制
|
// 开始绘制
|
||||||
var animate = core.material.animates[name];
|
var animate = core.material.animates[name];
|
||||||
@ -1033,7 +1026,7 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
|
|||||||
core.playSound(animate.se);
|
core.playSound(animate.se);
|
||||||
|
|
||||||
var draw = function (index) {
|
var draw = function (index) {
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('animate');
|
||||||
|
|
||||||
var frame = animate.frames[index];
|
var frame = animate.frames[index];
|
||||||
frame.forEach(function (t) {
|
frame.forEach(function (t) {
|
||||||
@ -1046,7 +1039,7 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
|
|||||||
var cx = centerX+t.x, cy=centerY+t.y;
|
var cx = centerX+t.x, cy=centerY+t.y;
|
||||||
|
|
||||||
if (!t.mirror && !t.angle) {
|
if (!t.mirror && !t.angle) {
|
||||||
core.canvas.animate.drawImage(image, cx-realWidth/2 - core.maps.currentOffsetPos.x, cy-realHeight/2 - core.maps.currentOffsetPos.y, realWidth, realHeight);
|
core.canvas.animate.drawImage(image, cx-realWidth/2 - core.bigmap.offsetX, cy-realHeight/2 - core.bigmap.offsetY, realWidth, realHeight);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.saveCanvas('animate');
|
core.saveCanvas('animate');
|
||||||
@ -1055,7 +1048,7 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
|
|||||||
core.canvas.animate.rotate(-t.angle*Math.PI/180);
|
core.canvas.animate.rotate(-t.angle*Math.PI/180);
|
||||||
if (t.mirror)
|
if (t.mirror)
|
||||||
core.canvas.animate.scale(-1,1);
|
core.canvas.animate.scale(-1,1);
|
||||||
core.canvas.animate.drawImage(image, -realWidth/2 - core.maps.currentOffsetPos.x, -realHeight/2 - core.maps.currentOffsetPos.y, realWidth, realHeight);
|
core.canvas.animate.drawImage(image, -realWidth/2 - core.bigmap.offsetX, -realHeight/2 - core.bigmap.offsetY, realWidth, realHeight);
|
||||||
core.loadCanvas('animate');
|
core.loadCanvas('animate');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1066,7 +1059,7 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
|
|||||||
core.interval.animateInterval = setInterval(function (t) {
|
core.interval.animateInterval = setInterval(function (t) {
|
||||||
if (index == animate.frames.length) {
|
if (index == animate.frames.length) {
|
||||||
clearInterval(core.interval.animateInterval);
|
clearInterval(core.interval.animateInterval);
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('animate');
|
||||||
core.setAlpha('animate', 1);
|
core.setAlpha('animate', 1);
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
return;
|
return;
|
||||||
|
|||||||
46
libs/ui.js
46
libs/ui.js
@ -18,12 +18,12 @@ ui.prototype.init = function () {
|
|||||||
ui.prototype.clearMap = function (map, x, y, width, height) {
|
ui.prototype.clearMap = function (map, x, y, width, height) {
|
||||||
if (map == 'all') {
|
if (map == 'all') {
|
||||||
for (var m in core.canvas) {
|
for (var m in core.canvas) {
|
||||||
core.canvas[m].clearRect(0, 0, 416, 416);
|
core.canvas[m].clearRect(0, 0, core.bigmap.width*32, core.bigmap.height*32);
|
||||||
}
|
}
|
||||||
core.dom.gif.innerHTML = "";
|
core.dom.gif.innerHTML = "";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.canvas[map].clearRect(x||0, y||0, width||416, height||416);
|
core.canvas[map].clearRect(x||0, y||0, width||core.bigmap.width*32, height||core.bigmap.height*32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ ui.prototype.setFillStyle = function (map, style) {
|
|||||||
ui.prototype.closePanel = function () {
|
ui.prototype.closePanel = function () {
|
||||||
core.status.boxAnimateObjs = [];
|
core.status.boxAnimateObjs = [];
|
||||||
clearInterval(core.status.event.interval);
|
clearInterval(core.status.event.interval);
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1.0);
|
core.setAlpha('ui', 1.0);
|
||||||
core.unLockControl();
|
core.unLockControl();
|
||||||
core.status.event.data = null;
|
core.status.event.data = null;
|
||||||
@ -380,7 +380,7 @@ ui.prototype.drawTextBox = function(content) {
|
|||||||
|
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
core.status.boxAnimateObjs = [];
|
core.status.boxAnimateObjs = [];
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
|
|
||||||
// var contents = content.split('\n');
|
// var contents = content.split('\n');
|
||||||
// var contents = core.splitLines('ui', content, );
|
// var contents = core.splitLines('ui', content, );
|
||||||
@ -541,7 +541,7 @@ ui.prototype.drawChoices = function(content, choices) {
|
|||||||
|
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.setFillStyle('ui', background);
|
core.setFillStyle('ui', background);
|
||||||
|
|
||||||
@ -728,7 +728,7 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
|
|||||||
if (core.status.event.selection<0) core.status.event.selection=0;
|
if (core.status.event.selection<0) core.status.event.selection=0;
|
||||||
|
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.setFillStyle('ui', background);
|
core.setFillStyle('ui', background);
|
||||||
core.setFont('ui', "bold 19px Verdana");
|
core.setFont('ui', "bold 19px Verdana");
|
||||||
@ -872,7 +872,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
|||||||
|
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
var left=10, right=416-2*left;
|
var left=10, right=416-2*left;
|
||||||
|
|
||||||
|
|
||||||
@ -891,7 +891,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
|||||||
core.fillRect('ui', left, top, right, bottom, '#000000');
|
core.fillRect('ui', left, top, right, bottom, '#000000');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
||||||
core.clearMap('data',0,0,416,416);
|
core.clearMap('data');
|
||||||
|
|
||||||
clearInterval(core.interval.tipAnimate);
|
clearInterval(core.interval.tipAnimate);
|
||||||
core.setAlpha('data', 1);
|
core.setAlpha('data', 1);
|
||||||
@ -1099,9 +1099,9 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
|||||||
// 战斗结束
|
// 战斗结束
|
||||||
clearInterval(battleInterval);
|
clearInterval(battleInterval);
|
||||||
core.status.boxAnimateObjs = [];
|
core.status.boxAnimateObjs = [];
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1.0);
|
core.setAlpha('ui', 1.0);
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
if (core.status.event.id=='battle') {
|
if (core.status.event.id=='battle') {
|
||||||
core.unLockControl();
|
core.unLockControl();
|
||||||
core.status.event.id=null;
|
core.status.event.id=null;
|
||||||
@ -1121,7 +1121,7 @@ ui.prototype.drawWaiting = function(text) {
|
|||||||
core.status.event.id = 'waiting';
|
core.status.event.id = 'waiting';
|
||||||
|
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.setFillStyle('ui', background);
|
core.setFillStyle('ui', background);
|
||||||
|
|
||||||
@ -1219,7 +1219,7 @@ ui.prototype.drawCursor = function () {
|
|||||||
core.status.event.id = 'cursor';
|
core.status.event.id = 'cursor';
|
||||||
core.lockControl();
|
core.lockControl();
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
|
|
||||||
var width = 4;
|
var width = 4;
|
||||||
@ -1235,10 +1235,10 @@ ui.prototype.drawBook = function (index) {
|
|||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
|
|
||||||
clearInterval(core.interval.tipAnimate);
|
clearInterval(core.interval.tipAnimate);
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
core.setOpacity('data', 1);
|
core.setOpacity('data', 1);
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.setFillStyle('ui', background);
|
core.setFillStyle('ui', background);
|
||||||
core.fillRect('ui', 0, 0, 416, 416);
|
core.fillRect('ui', 0, 0, 416, 416);
|
||||||
@ -1400,7 +1400,7 @@ ui.prototype.drawBookDetail = function (index) {
|
|||||||
core.status.event.id = 'book-detail';
|
core.status.event.id = 'book-detail';
|
||||||
clearInterval(core.interval.tipAnimate);
|
clearInterval(core.interval.tipAnimate);
|
||||||
|
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
core.setOpacity('data', 1);
|
core.setOpacity('data', 1);
|
||||||
|
|
||||||
var left=10, right=416-2*left;
|
var left=10, right=416-2*left;
|
||||||
@ -1453,7 +1453,7 @@ ui.prototype.drawFly = function(page) {
|
|||||||
var floorId = core.status.hero.flyRange[page];
|
var floorId = core.status.hero.flyRange[page];
|
||||||
var title = core.status.maps[floorId].title;
|
var title = core.status.maps[floorId].title;
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 0.85);
|
core.setAlpha('ui', 0.85);
|
||||||
core.fillRect('ui', 0, 0, 416, 416, '#000000');
|
core.fillRect('ui', 0, 0, 416, 416, '#000000');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
@ -1490,11 +1490,11 @@ ui.prototype.drawMaps = function (index) {
|
|||||||
|
|
||||||
clearTimeout(core.interval.tipAnimate);
|
clearTimeout(core.interval.tipAnimate);
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
this.drawThumbnail(floorId, 'ui', core.status.maps[floorId].blocks, 0, 0, 416);
|
this.drawThumbnail(floorId, 'ui', core.status.maps[floorId].blocks, 0, 0, 416);
|
||||||
|
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
core.setOpacity('data', 0.2);
|
core.setOpacity('data', 0.2);
|
||||||
core.canvas.data.textAlign = 'left';
|
core.canvas.data.textAlign = 'left';
|
||||||
core.setFont('data', '16px Arial');
|
core.setFont('data', '16px Arial');
|
||||||
@ -1538,7 +1538,7 @@ ui.prototype.drawToolbox = function(index) {
|
|||||||
|
|
||||||
core.status.event.data=selectId;
|
core.status.event.data=selectId;
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 0.85);
|
core.setAlpha('ui', 0.85);
|
||||||
core.fillRect('ui', 0, 0, 416, 416, '#000000');
|
core.fillRect('ui', 0, 0, 416, 416, '#000000');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
@ -1660,7 +1660,7 @@ ui.prototype.drawSLPanel = function(index) {
|
|||||||
|
|
||||||
core.status.event.data=index;
|
core.status.event.data=index;
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 0.85);
|
core.setAlpha('ui', 0.85);
|
||||||
core.fillRect('ui', 0, 0, 416, 416, '#000000');
|
core.fillRect('ui', 0, 0, 416, 416, '#000000');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
@ -1715,8 +1715,8 @@ ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, heroL
|
|||||||
var blockIcon = core.material.icons.terrains[groundId];
|
var blockIcon = core.material.icons.terrains[groundId];
|
||||||
var blockImage = core.material.images.terrains;
|
var blockImage = core.material.images.terrains;
|
||||||
var persize = size/13;
|
var persize = size/13;
|
||||||
var mw = core.floors[floorId].tileWidth;
|
var mw = core.floors[floorId].width || 13;
|
||||||
var mh = core.floors[floorId].tileHeight;
|
var mh = core.floors[floorId].height || 13;
|
||||||
for (var i=0;i<13;i++) {
|
for (var i=0;i<13;i++) {
|
||||||
for (var j=0;j<13;j++) {
|
for (var j=0;j<13;j++) {
|
||||||
core.canvas[canvas].drawImage(blockImage, 0, blockIcon * 32, 32, 32, x + i * persize, y + j * persize, persize, persize);
|
core.canvas[canvas].drawImage(blockImage, 0, blockIcon * 32, 32, 32, x + i * persize, y + j * persize, persize, persize);
|
||||||
@ -1792,7 +1792,7 @@ ui.prototype.drawKeyBoard = function () {
|
|||||||
core.lockControl();
|
core.lockControl();
|
||||||
core.status.event.id = 'keyBoard';
|
core.status.event.id = 'keyBoard';
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
|
|
||||||
var left = 16, top = 48, right = 416 - 2 * left, bottom = 416 - 2 * top;
|
var left = 16, top = 48, right = 416 - 2 * left, bottom = 416 - 2 * top;
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
|
|||||||
@ -352,6 +352,11 @@ utils.prototype.subarray = function (a, b) {
|
|||||||
return na;
|
return na;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
utils.prototype.clamp = function (x, a, b) {
|
||||||
|
var min=Math.min(a, b), max=Math.max(a, b);
|
||||||
|
return Math.min(Math.max(x, min), max);
|
||||||
|
}
|
||||||
|
|
||||||
////// Base64加密 //////
|
////// Base64加密 //////
|
||||||
utils.prototype.encodeBase64 = function (str) {
|
utils.prototype.encodeBase64 = function (str) {
|
||||||
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
|
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =
|
enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =
|
||||||
{
|
{
|
||||||
'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'point': 0, 'special': [1,5,7,8]},
|
'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'point': 0, 'special': [1,5,7,8]},
|
||||||
'redSlime': {'name': '红头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0},
|
'redSlime': {'name': '红头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': [16,18], 'value': 10},
|
||||||
'blackSlime': {'name': '青头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0},
|
'blackSlime': {'name': '青头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0},
|
||||||
'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'point': 0, 'special': [1,9]},
|
'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'point': 0, 'special': [1,9]},
|
||||||
'bat': {'name': '小蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 2, 'experience': 0, 'point': 0, 'special': 1},
|
'bat': {'name': '小蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 2, 'experience': 0, 'point': 0, 'special': 1},
|
||||||
|
|||||||
@ -18,7 +18,7 @@ main.floors.MT0=
|
|||||||
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 1, 1, 0, 0, 1, 0,202,202, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0,202,202, 0],
|
[ 0, 0, 0, 0, 1, 1, 45, 0, 1, 0,202,202, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0,202,202, 0],
|
||||||
[ 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0],
|
[ 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0],
|
||||||
@ -37,8 +37,8 @@ main.floors.MT0=
|
|||||||
[ 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,202, 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]
|
||||||
],
|
],
|
||||||
"tileWidth":26,
|
"width":26,
|
||||||
"tileHeight":26,
|
"height":26,
|
||||||
"firstArrive": [],
|
"firstArrive": [],
|
||||||
"events": {},
|
"events": {},
|
||||||
"changeFloor": {},
|
"changeFloor": {},
|
||||||
|
|||||||
@ -453,7 +453,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
core.lockControl();
|
core.lockControl();
|
||||||
core.status.event.id = 'about';
|
core.status.event.id = 'about';
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
var left = 48, top = 36, right = 416 - 2 * left, bottom = 416 - 2 * top;
|
var left = 48, top = 36, right = 416 - 2 * left, bottom = 416 - 2 * top;
|
||||||
|
|
||||||
core.setAlpha('ui', 0.85);
|
core.setAlpha('ui', 0.85);
|
||||||
|
|||||||
@ -290,7 +290,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"bigKey": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
"bigKey": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||||
"bomb": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});",
|
"bomb": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});",
|
||||||
"hammer": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});",
|
"hammer": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});",
|
||||||
"centerFly": "core.clearMap('hero', 0, 0, 416, 416);\ncore.setHeroLoc('x', core.status.event.data.x);\ncore.setHeroLoc('y', core.status.event.data.y);\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
|
"centerFly": "core.clearMap('hero');\ncore.setHeroLoc('x', core.status.event.data.x);\ncore.setHeroLoc('y', core.status.event.data.y);\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
|
||||||
"upFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});",
|
"upFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});",
|
||||||
"downFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});",
|
"downFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});",
|
||||||
"poisonWine": "core.setFlag('poison', false);",
|
"poisonWine": "core.setFlag('poison', false);",
|
||||||
|
|||||||
@ -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: 150;
|
z-index: 135;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#statusBar .status{
|
#statusBar .status{
|
||||||
@ -257,6 +257,7 @@ span#poison, span#weak, span#curse {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
background: #000000;
|
background: #000000;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
z-index: 135;
|
||||||
}
|
}
|
||||||
|
|
||||||
#bg {
|
#bg {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user