Browse Source

bug: due to renderer changes, auras were rendering as 8x8 instead of 16x16

tags/v0.8.4^2
Shaun 3 years ago
parent
commit
b64010c8bc
5 changed files with 31 additions and 28 deletions
  1. BIN
     
  2. BIN
     
  3. +28
    -26
      src/client/js/components/effects.js
  4. +1
    -1
      src/client/js/rendering/renderer.js
  5. +2
    -1
      src/server/config/clientConfig.js

BIN
View File


BIN
View File


+ 28
- 26
src/client/js/components/effects.js View File

@@ -28,49 +28,47 @@ define([

init: function (blueprint) {
this.effects = this.effects
.filter(function (e) {
return (auras[e] !== null);
}, this)
.map(function (e) {
.filter(e => auras[e] !== null)
.map(e => {
return {
name: e,
sprite: renderer.buildObject({
layerName: 'effects',
sheetName: 'auras',
x: this.obj.x - 0.5,
y: this.obj.y - 0.5,
w: scale * 2,
h: scale * 2,
x: this.obj.x,
y: this.obj.y + 1,
w: scale * 3,
h: scale * 3,
cell: auras[e]
})
};
}, this);
});
},
extend: function (blueprint) {
if (blueprint.addEffects) {
blueprint.addEffects = blueprint.addEffects
.filter(function (e) {
.filter(e => {
return (auras[e] !== null);
})
.map(function (e) {
.map(e => {
return {
name: e,
sprite: renderer.buildObject({
layerName: 'effects',
sheetName: 'auras',
x: this.obj.x - 0.5,
y: this.obj.y - 0.5,
w: scale * 2,
h: scale * 2,
x: this.obj.x,
y: this.obj.y + 1,
w: scale * 3,
h: scale * 3,
cell: auras[e]
})
};
}, this);
});

this.effects.push.apply(this.effects, blueprint.addEffects || []);
}
if (blueprint.removeEffects) {
blueprint.removeEffects.forEach(function (r) {
blueprint.removeEffects.forEach(r => {
let effect = this.effects.find(e => e.name === r);

if (!effect)
@@ -82,7 +80,7 @@ define([
});

this.effects.spliceFirstWhere(e => e.name === r);
}, this);
});
}
},

@@ -96,8 +94,8 @@ define([
this.alphaDir *= -1;
}

let x = (this.obj.x - 0.5) * scale;
let y = (this.obj.y - 0.5) * scale;
let x = this.obj.x;
let y = this.obj.y;

let useAlpha = this.alpha;
if (useAlpha < this.alphaCutoff)
@@ -107,21 +105,25 @@ define([
useAlpha /= (this.alphaMax - this.alphaCutoff);
}

this.effects.forEach(function (e) {
this.effects.forEach(e => {
renderer.setSpritePosition({
x,
y: y + 1,
sprite: e.sprite
});

e.sprite.alpha = useAlpha;
e.sprite.x = x;
e.sprite.y = y;
}, this);
},

setVisible: function (visible) {
this.effects.forEach(function (e) {
this.effects.forEach(e => {
e.sprite.visible = visible;
}, this);
});
},

destroy: function () {
this.effects.forEach(function (e) {
this.effects.forEach(e => {
renderer.destroyObject({
layerName: 'effects',
sprite: e.sprite


+ 1
- 1
src/client/js/rendering/renderer.js View File

@@ -792,7 +792,7 @@ define([
},

setSpritePosition: function (obj) {
const { sprite, x, y, flipX, offsetX, offsetY } = obj;
const { sprite, x, y, flipX, offsetX = 0, offsetY = 0 } = obj;

sprite.x = (x * scale) + (flipX ? scale : 0) + offsetX;
const oldY = sprite.y;


+ 2
- 1
src/server/config/clientConfig.js View File

@@ -29,7 +29,8 @@ const config = {
bigTextures: [
'animBigObjects',
'bigObjects',
'bosses'
'bosses',
'auras'
],
atlasTextures: [
'tiles',


Loading…
Cancel
Save