2020-03-22 14:22:52 +01:00
|
|
|
var Sprite = require("./Sprite"),
|
|
|
|
AnimManager = require("./AnimManager");
|
2020-02-20 08:40:50 +01:00
|
|
|
|
2019-08-20 17:59:26 +02:00
|
|
|
class TileSprite extends Sprite {
|
2020-03-21 17:22:28 +01:00
|
|
|
constructor(texture, w, h) {
|
|
|
|
super(texture);
|
|
|
|
this.tileW = w;
|
|
|
|
this.tileH = h;
|
|
|
|
this.frame = { x: 0, y: 0 };
|
2020-03-22 14:22:52 +01:00
|
|
|
this.anims = new AnimManager(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
update(dt) {
|
|
|
|
this.anims.update(dt);
|
|
|
|
}
|
|
|
|
|
|
|
|
get w() {
|
|
|
|
return this.tileW * Math.abs(this.scale.x);
|
|
|
|
}
|
|
|
|
|
|
|
|
get h() {
|
|
|
|
return this.tileH * Math.abs(this.scale.y);
|
2020-03-21 17:22:28 +01:00
|
|
|
}
|
2019-08-20 17:59:26 +02:00
|
|
|
}
|
|
|
|
|
2020-02-29 13:45:56 +01:00
|
|
|
module.exports = TileSprite;
|