drawmap
This commit is contained in:
parent
7d4f8f41af
commit
b71442b099
@ -407,8 +407,6 @@ events.prototype.doAction = function() {
|
|||||||
}
|
}
|
||||||
if (floorId==core.status.floorId) {
|
if (floorId==core.status.floorId) {
|
||||||
core.drawMap(floorId);
|
core.drawMap(floorId);
|
||||||
core.drawHero();
|
|
||||||
core.updateStatusBar();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.doAction();
|
this.doAction();
|
||||||
@ -1094,29 +1092,27 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
core.drawMap(floorId, function () {
|
core.drawMap(floorId, function () {
|
||||||
setTimeout(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.drawHero();
|
core.drawHero();
|
||||||
core.updateStatusBar();
|
|
||||||
|
|
||||||
var changed = function () {
|
var changed = function () {
|
||||||
core.unLockControl();
|
core.unLockControl();
|
||||||
core.status.replay.animate=false;
|
core.status.replay.animate=false;
|
||||||
core.events.afterChangeFloor(floorId);
|
core.events.afterChangeFloor(floorId);
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
}
|
}
|
||||||
if (displayAnimate) {
|
if (displayAnimate) {
|
||||||
core.hide(core.dom.floorMsgGroup, time/4, function () {
|
core.hide(core.dom.floorMsgGroup, time/4, function () {
|
||||||
changed();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
changed();
|
changed();
|
||||||
}
|
});
|
||||||
}, 25)
|
}
|
||||||
|
else {
|
||||||
|
changed();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
core.playSound('floor.mp3');
|
core.playSound('floor.mp3');
|
||||||
|
|||||||
11
libs/maps.js
11
libs/maps.js
@ -389,8 +389,10 @@ maps.prototype.drawMap = function (mapName, callback) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
drawEvent();
|
drawEvent();
|
||||||
|
core.setGlobalAnimate(core.values.animateSpeed);
|
||||||
|
core.drawHero();
|
||||||
|
core.updateStatusBar();
|
||||||
}
|
}
|
||||||
core.setGlobalAnimate(core.values.animateSpeed);
|
|
||||||
if (core.isset(callback))
|
if (core.isset(callback))
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
@ -398,7 +400,7 @@ maps.prototype.drawMap = function (mapName, callback) {
|
|||||||
////// 绘制Autotile //////
|
////// 绘制Autotile //////
|
||||||
maps.prototype.drawAutotile = function(ctx, mapArr, block, size, left, top){
|
maps.prototype.drawAutotile = function(ctx, mapArr, block, size, left, top){
|
||||||
var indexArrs = [ //16种组合的图块索引数组; // 将autotile分割成48块16*16的小块; 数组索引即对应各个小块
|
var indexArrs = [ //16种组合的图块索引数组; // 将autotile分割成48块16*16的小块; 数组索引即对应各个小块
|
||||||
// +----+----+----+----+----+----+
|
// +----+----+----+----+----+----+
|
||||||
[10, 9, 4, 3 ], //0 bin:0000 | 1 | 2 | 3 | 4 | 5 | 6 |
|
[10, 9, 4, 3 ], //0 bin:0000 | 1 | 2 | 3 | 4 | 5 | 6 |
|
||||||
[10, 9, 4, 13], //1 bin:0001 +----+----+----+----+----+----+
|
[10, 9, 4, 13], //1 bin:0001 +----+----+----+----+----+----+
|
||||||
[10, 9, 18, 3 ], //2 bin:0010 | 7 | 8 | 9 | 10 | 11 | 12 |
|
[10, 9, 18, 3 ], //2 bin:0010 | 7 | 8 | 9 | 10 | 11 | 12 |
|
||||||
@ -899,8 +901,5 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
|
|||||||
maps.prototype.resetMap = function() {
|
maps.prototype.resetMap = function() {
|
||||||
var floorId = core.status.floorId;
|
var floorId = core.status.floorId;
|
||||||
core.status.maps[floorId] = this.loadFloor(floorId);
|
core.status.maps[floorId] = this.loadFloor(floorId);
|
||||||
this.drawMap(floorId, function() {
|
this.drawMap(floorId)
|
||||||
core.drawHero();
|
|
||||||
core.updateStatusBar();
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
@ -278,13 +278,13 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"useItemEffect": {
|
"useItemEffect": {
|
||||||
"book": "core.ui.drawBook(0);",
|
"book": "core.ui.drawBook(0);",
|
||||||
"fly": "core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));",
|
"fly": "core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));",
|
||||||
"earthquake": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero();\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
"earthquake": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||||
"pickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero();\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
"pickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||||
"icePickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero(), 'stop');\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
"icePickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||||
"snow": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero();\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
"snow": "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.drawHero();\n core.updateFg();\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.drawHero();\n core.updateFg();\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.drawHero();\n core.updateFg();\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', 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 + '使用成功');",
|
||||||
"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});",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user