drawHeroAnimate

This commit is contained in:
ckcz123 2019-12-26 16:18:45 +08:00
parent 88078448a7
commit c42c419afc
3 changed files with 6 additions and 7 deletions

View File

@ -170,13 +170,7 @@ control.prototype._animationFrame_animate = function (timestamp) {
});
core.status.animateObjs.forEach(function (obj) {
if (obj.hero) {
// calculate position
var x = core.getHeroLoc('x'), y = core.getHeroLoc('y'), direction = core.getHeroLoc('direction');
var offset = 4 * core.status.heroMoving;
if (offset < 0) offset = 0;
var way = core.utils.scan[direction];
var centerX = 32 * x + way.x * offset + 16, centerY = 32 * y + way.y * offset + 16;
core.maps._drawAnimateFrame(obj.animate, centerX, centerY, obj.index++);
core.maps._drawAnimateFrame(obj.animate, core.status.heroCenter.px, core.status.heroCenter.py, obj.index++);
} else {
core.maps._drawAnimateFrame(obj.animate, obj.centerX, obj.centerY, obj.index++);
}
@ -816,6 +810,8 @@ control.prototype.drawHero = function (status, offset) {
core.bigmap.offsetY = core.clamp((y - core.__HALF_SIZE__) * 32 + offsetY, 0, 32*core.bigmap.height-core.__PIXELS__);
core.clearAutomaticRouteNode(x+dx, y+dy);
core.clearMap('hero');
core.status.heroCenter.px = 32 * x + offsetX + 16;
core.status.heroCenter.py = 32 * y + offsetY + 32 - core.material.icons.hero.height / 2;
if (!core.hasFlag('hideHero')) {
this._drawHero_getDrawObjs(direction, x, y, status, offset).forEach(function (block) {

View File

@ -116,6 +116,7 @@ function core() {
// 勇士属性
'hero': {},
'heroCenter': {'px': null, 'py': null},
// 当前地图
'floorId': null,

View File

@ -2700,6 +2700,8 @@ events.prototype._jumpHero_jumping = function (jumpInfo) {
core.control.updateViewport();
core.drawImage('hero', core.material.images.hero, jumpInfo.icon.stop, jumpInfo.icon.loc * height, width, height,
nowx + (32 - width) / 2 - core.bigmap.offsetX, nowy + 32-height - core.bigmap.offsetY, width, height);
core.status.heroCenter.px = nowx + 16;
core.status.heroCenter.py = nowy + 32 - height / 2;
}
events.prototype._jumpHero_finished = function (animate, ex, ey, callback) {