From dbdfaafc447a4d09377619a7c824b87539453007 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Wed, 14 Dec 2016 20:13:11 +0200 Subject: Make Xmas fork --- src/gameobject.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/gameobject.js') 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 +} -- cgit v1.3