Fixed some issues with Sprite and TileSprite
This commit is contained in:
parent
924af6745e
commit
5bc38b8e65
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user