2020-04-19 19:44:52 +02:00
|
|
|
var Sprite = require("./Sprite"),
|
|
|
|
AnimManager = require("./AnimManager");
|
2019-12-31 15:33:27 +01:00
|
|
|
|
|
|
|
class TileSpriteXML extends Sprite {
|
2020-03-21 17:22:28 +01:00
|
|
|
constructor(texture, xml, index) {
|
|
|
|
super(texture);
|
|
|
|
var src = xml.array[index];
|
|
|
|
this.imgPos = { x: src["x"], y: src["y"] };
|
|
|
|
this.width = src["width"];
|
|
|
|
this.height = src["height"];
|
2020-04-19 19:44:52 +02:00
|
|
|
this.anims = new AnimManager(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
update(dt) {
|
|
|
|
this.anims.update(dt);
|
|
|
|
}
|
|
|
|
|
|
|
|
get w() {
|
|
|
|
return this.width * Math.abs(this.scale.x);
|
|
|
|
}
|
|
|
|
|
|
|
|
get h() {
|
|
|
|
return this.height * Math.abs(this.scale.y);
|
2020-03-21 17:22:28 +01:00
|
|
|
}
|
2019-12-31 15:33:27 +01:00
|
|
|
}
|
|
|
|
|
2020-02-29 13:45:56 +01:00
|
|
|
module.exports = TileSpriteXML;
|