diff options
Diffstat (limited to 'src/gameobject.js')
| -rw-r--r-- | src/gameobject.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gameobject.js b/src/gameobject.js index 0b50553..43218b1 100644 --- a/src/gameobject.js +++ b/src/gameobject.js @@ -1,12 +1,16 @@ function GameObject(texture) { - this.texture = PIXI.Texture.fromImage("res/" + texture + ".png"); - this.sprite = new PIXI.Sprite(this.texture); + this.updateTexture(texture); this.initPosition(); this.active = true; this.objectType = "gameobject"; } +GameObject.prototype.updateTexture = function(name) { + this.texture = PIXI.Texture.fromImage("res/" + name + ".png"); + this.sprite = new PIXI.Sprite(this.texture); +} + GameObject.prototype.initPosition = function() { this.sprite.anchor.x = 0.5; this.sprite.anchor.y = 0.5; @@ -17,4 +21,4 @@ GameObject.prototype.initPosition = function() { GameObject.prototype.update = function() { -}
\ No newline at end of file +} |
