blob: 91ec11fbdb23425b993422bb4cd33be090a08d95 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
var app = app || {};
class BaseGameObject {
constructor(id, sprite, size, position) {
this.id = id;
this.sprite = sprite;
this.container = new PIXI.Container();
this.sprite.width = size.width;
this.sprite.height = size.height;
this.container.width = size.width;
this.container.height = size.height;
this.container.x = position.x;
this.container.y = position.y;
this.container.addChild(this.sprite);
this.container.pivot.x = this.container.width / 2;
this.container.pivot.y = this.container.height / 2;
}
update() {}
draw() {
return this.container;
}
destroy() {
this.container.parent.removeChild(this.container);
this.container.destroy({children: false, texture: false, baseTexture: false});
}
}
|