Merge branch 'ckcz123-master'
This commit is contained in:
commit
4d7233d502
111
libs/core.js
111
libs/core.js
@ -470,28 +470,36 @@ core.prototype.keyUp = function(keyCode) {
|
|||||||
|
|
||||||
switch (keyCode) {
|
switch (keyCode) {
|
||||||
case 27: // ESC
|
case 27: // ESC
|
||||||
core.ui.drawSettings(true);
|
if (core.status.heroStop)
|
||||||
|
core.ui.drawSettings(true);
|
||||||
break;
|
break;
|
||||||
case 71: // G
|
case 71: // G
|
||||||
core.useFly(true);
|
if (core.status.heroStop)
|
||||||
|
core.useFly(true);
|
||||||
break;
|
break;
|
||||||
case 88: // X
|
case 88: // X
|
||||||
core.openBook(true);
|
if (core.status.heroStop)
|
||||||
|
core.openBook(true);
|
||||||
break;
|
break;
|
||||||
case 83: // S
|
case 83: // S
|
||||||
core.save(true);
|
if (core.status.heroStop)
|
||||||
|
core.save(true);
|
||||||
break;
|
break;
|
||||||
case 68: // D
|
case 68: // D
|
||||||
core.load(true);
|
if (core.status.heroStop)
|
||||||
|
core.load(true);
|
||||||
break;
|
break;
|
||||||
case 84: // T
|
case 84: // T
|
||||||
core.openToolbox(true);
|
if (core.status.heroStop)
|
||||||
|
core.openToolbox(true);
|
||||||
break;
|
break;
|
||||||
case 90: // Z
|
case 90: // Z
|
||||||
core.turnHero();
|
if (core.status.heroStop)
|
||||||
|
core.turnHero();
|
||||||
break;
|
break;
|
||||||
case 75: // K
|
case 75: // K
|
||||||
core.ui.drawQuickShop(true);
|
if (core.status.heroStop)
|
||||||
|
core.ui.drawQuickShop(true);
|
||||||
break;
|
break;
|
||||||
case 37: // UP
|
case 37: // UP
|
||||||
break;
|
break;
|
||||||
@ -1136,10 +1144,10 @@ core.prototype.setHeroMoveTriggerInterval = function () {
|
|||||||
direction = core.getHeroLoc('direction');
|
direction = core.getHeroLoc('direction');
|
||||||
x = core.getHeroLoc('x');
|
x = core.getHeroLoc('x');
|
||||||
y = core.getHeroLoc('y');
|
y = core.getHeroLoc('y');
|
||||||
var noPass;
|
var noPass = core.noPass(x + scan[direction].x, y + scan[direction].y), canMove = core.canMove();
|
||||||
noPass = core.noPass(x + scan[direction].x, y + scan[direction].y);
|
if (noPass || !canMove) {
|
||||||
if (noPass) {
|
if (canMove) // 非箭头:触发
|
||||||
core.trigger(x + scan[direction].x, y + scan[direction].y);
|
core.trigger(x + scan[direction].x, y + scan[direction].y);
|
||||||
core.drawHero(direction, x, y, 'stop');
|
core.drawHero(direction, x, y, 'stop');
|
||||||
if (core.status.autoHeroMove) {
|
if (core.status.autoHeroMove) {
|
||||||
core.status.movedStep++;
|
core.status.movedStep++;
|
||||||
@ -1191,32 +1199,28 @@ core.prototype.turnHero = function(direction) {
|
|||||||
core.canvas.ui.clearRect(0, 0, 416, 416);
|
core.canvas.ui.clearRect(0, 0, 416, 416);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.prototype.moveHero = function (direction) {
|
core.prototype.canMove = function() {
|
||||||
core.setHeroLoc('direction', direction);
|
var direction = core.getHeroLoc('direction');
|
||||||
core.status.heroStop = false;
|
var nowBlock = core.getBlock(core.getHeroLoc('x'),core.getHeroLoc('y'));
|
||||||
var nowX = core.getHeroLoc('x');
|
|
||||||
var nowY = core.getHeroLoc('y');
|
|
||||||
var nowId, nowBlock = core.getBlock(nowX,nowY);
|
|
||||||
if (nowBlock!=null){
|
if (nowBlock!=null){
|
||||||
nowId = nowBlock.block.event.id;
|
nowId = nowBlock.block.event.id;
|
||||||
var nowIsArrow = nowId.slice(0, 5).toLowerCase() == 'arrow';
|
var nowIsArrow = nowId.slice(0, 5).toLowerCase() == 'arrow';
|
||||||
if(nowIsArrow){
|
if(nowIsArrow){
|
||||||
var nowArrow = nowId.slice(5).toLowerCase();
|
var nowArrow = nowId.slice(5).toLowerCase();
|
||||||
if (direction != nowArrow) {
|
if (direction != nowArrow) {
|
||||||
core.status.heroStop = true;
|
// core.status.heroStop = true;
|
||||||
core.turnHero(direction);
|
// core.turnHero(direction);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}console.log(direction,nowX,nowY, nowBlock, '1111')
|
}
|
||||||
var scan = {
|
var scan = {
|
||||||
'up': {'x': 0, 'y': -1},
|
'up': {'x': 0, 'y': -1},
|
||||||
'left': {'x': -1, 'y': 0},
|
'left': {'x': -1, 'y': 0},
|
||||||
'down': {'x': 0, 'y': 1},
|
'down': {'x': 0, 'y': 1},
|
||||||
'right': {'x': 1, 'y': 0}
|
'right': {'x': 1, 'y': 0}
|
||||||
};
|
};
|
||||||
var nextX = nowX + scan[direction].x;
|
var nextBlock = core.getBlock(core.nextX(),core.nextY());
|
||||||
var nextY = nowY + scan[direction].y;
|
|
||||||
var nextId, nextBlock = core.getBlock(nextX,nextY);
|
|
||||||
if (nextBlock!=null){
|
if (nextBlock!=null){
|
||||||
nextId = nextBlock.block.event.id;
|
nextId = nextBlock.block.event.id;
|
||||||
// 遇到单向箭头处理
|
// 遇到单向箭头处理
|
||||||
@ -1224,11 +1228,18 @@ core.prototype.moveHero = function (direction) {
|
|||||||
if(isArrow){
|
if(isArrow){
|
||||||
var nextArrow = nextId.slice(5).toLowerCase();
|
var nextArrow = nextId.slice(5).toLowerCase();
|
||||||
if ( (scan[direction].x + scan[nextArrow].x) == 0 && (scan[direction].y + scan[nextArrow].y) == 0 ) {
|
if ( (scan[direction].x + scan[nextArrow].x) == 0 && (scan[direction].y + scan[nextArrow].y) == 0 ) {
|
||||||
core.status.heroStop = true;
|
// core.status.heroStop = true;
|
||||||
core.turnHero(direction);
|
// core.turnHero(direction);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}console.log(direction,nextX,nextY, nextBlock, '2222')
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.prototype.moveHero = function (direction) {
|
||||||
|
core.setHeroLoc('direction', direction);
|
||||||
|
core.status.heroStop = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
core.prototype.moveOneStep = function() {
|
core.prototype.moveOneStep = function() {
|
||||||
@ -3022,8 +3033,9 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
var BASE_LINEHEIGHT = 32;
|
var BASE_LINEHEIGHT = 32;
|
||||||
var SPACE = 3;
|
var SPACE = 3;
|
||||||
var DEFAULT_FONT_SIZE = 16;
|
var DEFAULT_FONT_SIZE = 16;
|
||||||
//适配宽度阈值
|
//适配宽度 422
|
||||||
var ADAPT_WIDTH = DEFAULT_CANVAS_WIDTH;
|
var ADAPT_WIDTH = DEFAULT_CANVAS_WIDTH;
|
||||||
|
var CHANGE_WIDTH = DEFAULT_CANVAS_WIDTH+DEFAULT_BAR_WIDTH;
|
||||||
//判断横竖屏
|
//判断横竖屏
|
||||||
var width = clientWidth;
|
var width = clientWidth;
|
||||||
var isHorizontal = false;
|
var isHorizontal = false;
|
||||||
@ -3046,23 +3058,30 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
if (!core.flags.enableDebuff) count--;
|
if (!core.flags.enableDebuff) count--;
|
||||||
|
|
||||||
var statusLineHeight = BASE_LINEHEIGHT * 9/count;
|
var statusLineHeight = BASE_LINEHEIGHT * 9/count;
|
||||||
|
|
||||||
var shopDisplay, mdefDisplay, expDisplay;
|
var shopDisplay, mdefDisplay, expDisplay;
|
||||||
mdefDisplay = core.flags.enableMDef ? 'block' : 'none';
|
mdefDisplay = core.flags.enableMDef ? 'block' : 'none';
|
||||||
expDisplay = core.flags.enableExperience ? 'block' : 'none';
|
expDisplay = core.flags.enableExperience ? 'block' : 'none';
|
||||||
|
|
||||||
statusBarBorder = '3px #fff solid';
|
statusBarBorder = '3px #fff solid';
|
||||||
toolBarBorder = '3px #fff solid';
|
toolBarBorder = '3px #fff solid';
|
||||||
|
var zoom = (ADAPT_WIDTH - width) / 4.22;
|
||||||
|
var aScale = 1 - zoom / 100;
|
||||||
|
|
||||||
// 移动端
|
// 移动端
|
||||||
if (width < ADAPT_WIDTH) {
|
if (width < CHANGE_WIDTH) {
|
||||||
var zoom = (ADAPT_WIDTH - width) / 4.22;
|
if(width < ADAPT_WIDTH){
|
||||||
var scale = 1 - zoom / 100;
|
|
||||||
|
core.domStyle.scale = aScale;
|
||||||
core.domStyle.scale = scale;
|
canvasWidth = width;
|
||||||
|
}else{
|
||||||
canvasWidth = width;
|
canvasWidth = DEFAULT_CANVAS_WIDTH;
|
||||||
|
core.domStyle.scale = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
var scale = core.domStyle.scale
|
||||||
|
var tempWidth = DEFAULT_CANVAS_WIDTH * scale;
|
||||||
fontSize = DEFAULT_FONT_SIZE * scale;
|
fontSize = DEFAULT_FONT_SIZE * scale;
|
||||||
|
|
||||||
if(!isHorizontal){ //竖屏
|
if(!isHorizontal){ //竖屏
|
||||||
core.domStyle.screenMode = 'vertical';
|
core.domStyle.screenMode = 'vertical';
|
||||||
//显示快捷商店图标
|
//显示快捷商店图标
|
||||||
@ -3072,14 +3091,14 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
|
|
||||||
var tempTopBarH = scale * (BASE_LINEHEIGHT * col + SPACE * 2) + 6;
|
var tempTopBarH = scale * (BASE_LINEHEIGHT * col + SPACE * 2) + 6;
|
||||||
var tempBotBarH = scale * (BASE_LINEHEIGHT + SPACE * 4) + 6;
|
var tempBotBarH = scale * (BASE_LINEHEIGHT + SPACE * 4) + 6;
|
||||||
|
|
||||||
gameGroupHeight = width + tempTopBarH + tempBotBarH;
|
|
||||||
|
|
||||||
gameGroupWidth = width
|
gameGroupHeight = tempWidth + tempTopBarH + tempBotBarH;
|
||||||
|
|
||||||
|
gameGroupWidth = tempWidth
|
||||||
canvasTop = tempTopBarH;
|
canvasTop = tempTopBarH;
|
||||||
// canvasLeft = 0;
|
// canvasLeft = 0;
|
||||||
toolBarWidth = statusBarWidth = width;
|
toolBarWidth = statusBarWidth = canvasWidth;
|
||||||
statusBarHeight = tempTopBarH; //一共有3行加上两个padding空隙
|
statusBarHeight = tempTopBarH;
|
||||||
statusBarBorder = '3px #fff solid';
|
statusBarBorder = '3px #fff solid';
|
||||||
|
|
||||||
statusHeight = scale*BASE_LINEHEIGHT * .8;
|
statusHeight = scale*BASE_LINEHEIGHT * .8;
|
||||||
@ -3087,7 +3106,7 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
statusMaxWidth = scale * DEFAULT_BAR_WIDTH * .95;
|
statusMaxWidth = scale * DEFAULT_BAR_WIDTH * .95;
|
||||||
toolBarHeight = tempBotBarH;
|
toolBarHeight = tempBotBarH;
|
||||||
|
|
||||||
toolBarTop = statusBarHeight + width;
|
toolBarTop = statusBarHeight + canvasWidth;
|
||||||
toolBarBorder = '3px #fff solid';
|
toolBarBorder = '3px #fff solid';
|
||||||
toolsHeight = scale * BASE_LINEHEIGHT;
|
toolsHeight = scale * BASE_LINEHEIGHT;
|
||||||
toolsPMaxwidth = scale * DEFAULT_BAR_WIDTH * .4;
|
toolsPMaxwidth = scale * DEFAULT_BAR_WIDTH * .4;
|
||||||
@ -3098,8 +3117,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
}else { //横屏
|
}else { //横屏
|
||||||
core.domStyle.screenMode = 'horizontal';
|
core.domStyle.screenMode = 'horizontal';
|
||||||
shopDisplay = 'none';
|
shopDisplay = 'none';
|
||||||
gameGroupWidth = width + DEFAULT_BAR_WIDTH * scale;
|
gameGroupWidth = tempWidth + DEFAULT_BAR_WIDTH * scale;
|
||||||
gameGroupHeight = width;
|
gameGroupHeight = tempWidth;
|
||||||
canvasTop = 0;
|
canvasTop = 0;
|
||||||
// canvasLeft = DEFAULT_BAR_WIDTH * scale;
|
// canvasLeft = DEFAULT_BAR_WIDTH * scale;
|
||||||
toolBarWidth = statusBarWidth = DEFAULT_BAR_WIDTH * scale;
|
toolBarWidth = statusBarWidth = DEFAULT_BAR_WIDTH * scale;
|
||||||
@ -3108,7 +3127,7 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
|
|
||||||
statusHeight = scale*statusLineHeight * .8;
|
statusHeight = scale*statusLineHeight * .8;
|
||||||
statusLabelsLH = .8 * statusLineHeight *scale;
|
statusLabelsLH = .8 * statusLineHeight *scale;
|
||||||
toolBarHeight = width - statusBarHeight;
|
toolBarHeight = canvasWidth - statusBarHeight;
|
||||||
toolBarTop = scale*statusLineHeight * count + SPACE * 2;
|
toolBarTop = scale*statusLineHeight * count + SPACE * 2;
|
||||||
toolBarBorder = '3px #fff solid';
|
toolBarBorder = '3px #fff solid';
|
||||||
toolsHeight = scale * BASE_LINEHEIGHT;
|
toolsHeight = scale * BASE_LINEHEIGHT;
|
||||||
|
|||||||
@ -50,7 +50,7 @@ enemys.prototype.init = function () {
|
|||||||
'demonPriest': {'name': '魔神法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
'demonPriest': {'name': '魔神法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||||
'goldHornSlime': {'name': '金角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
'goldHornSlime': {'name': '金角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||||
'redKing': {'name': '红衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
'redKing': {'name': '红衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||||
'whiteKing': {'name': '白衣武士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 17, 'experience': 0, 'special': 15016},
|
'whiteKing': {'name': '白衣武士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 17, 'experience': 0, 'special': 16},
|
||||||
'blackMagician': {'name': '黑暗大法师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 12, 'experience': 0, 'special': 11, 'value': 1/3, 'bomb': false}, // 吸血怪需要在后面添加value代表吸血比例
|
'blackMagician': {'name': '黑暗大法师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 12, 'experience': 0, 'special': 11, 'value': 1/3, 'bomb': false}, // 吸血怪需要在后面添加value代表吸血比例
|
||||||
'silverSlime': {'name': '银头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 15, 'experience': 0, 'special': 14},
|
'silverSlime': {'name': '银头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 15, 'experience': 0, 'special': 14},
|
||||||
'swordEmperor': {'name': '剑圣', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
'swordEmperor': {'name': '剑圣', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||||
|
|||||||
@ -11,7 +11,7 @@ main.floors.sample0 = {
|
|||||||
[0, 0, 220, 0, 0, 20, 87, 3, 65, 64, 44, 43, 42],
|
[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],
|
[0, 246, 0, 246, 0, 20, 0, 3, 58, 59, 60, 61, 41],
|
||||||
[219, 0, 0, 0, 219, 20, 0, 3, 57, 26, 62, 63, 40],
|
[219, 0, 0, 0, 219, 20, 0, 3, 57, 26, 62, 63, 40],
|
||||||
[20, 20, 20, 20, 20, 20, 0, 3, 53, 54, 55, 56, 39],
|
[20, 20, 125, 20, 20, 20, 0, 3, 53, 54, 55, 56, 39],
|
||||||
[216, 247, 256, 235, 248, 6, 0, 3, 49, 50, 51, 52, 38],
|
[216, 247, 256, 235, 248, 6, 0, 3, 49, 50, 51, 52, 38],
|
||||||
[6, 6, 125, 6, 6, 6, 0, 1, 45, 46, 47, 48, 37],
|
[6, 6, 125, 6, 6, 6, 0, 1, 45, 46, 47, 48, 37],
|
||||||
[224, 254, 212, 232, 204, 5, 0, 1, 31, 32, 34, 33, 36],
|
[224, 254, 212, 232, 204, 5, 0, 1, 31, 32, 34, 33, 36],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user