Hi, everyone. Could you advise how correctly pass id of image form atlas when you create class?
Thank you in advance,
My class code:
var id= PIXI.loader.resources ["assets/images/sprites.json"].textures;
function Tower() {
//var towerTexture = TextureCache["Tower_1.png"]//PIXI.Texture.fromImage() // this one works fine
PIXI.Sprite.call(this, id["Tower_1.png"]); // when i use like this i got error that Cannot read property 'Tower_1.png' of undefined
this.x = 20;
this.y = 20;
}
Tower.prototype = Object.create(PIXI.Sprite.prototype);
And of course loader from main:
loader
.add("assets/images/tower/sprites.json")
.load(setup);