diff --git a/lib/Sprite.js b/lib/Sprite.js index 6e7d550..ddf9fb0 100644 --- a/lib/Sprite.js +++ b/lib/Sprite.js @@ -4,6 +4,7 @@ class Sprite { this.pos = { x: 0, y: 0 }; this.anchor = { x: 0, y: 0 }; this.scale = { x: 1, y: 1 }; + this.pivot = { x: 0, y: 0 }; this.rotation = 0; } } diff --git a/lib/TileSprite.js b/lib/TileSprite.js index 5c98763..fe9d283 100644 --- a/lib/TileSprite.js +++ b/lib/TileSprite.js @@ -1,4 +1,5 @@ -var Sprite = require("./Sprite"); +var Sprite = require("./Sprite"), + AnimManager = require("./AnimManager"); class TileSprite extends Sprite { constructor(texture, w, h) { @@ -6,6 +7,19 @@ class TileSprite extends Sprite { this.tileW = w; this.tileH = h; this.frame = { x: 0, y: 0 }; + 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); } }