aboutsummaryrefslogtreecommitdiffstats
path: root/src/gameobject.js
diff options
context:
space:
mode:
authorJan Tuomi <jan-sebastian.tuomi@aalto.fi>2016-12-14 20:13:11 +0200
committerJan Tuomi <jan-sebastian.tuomi@aalto.fi>2016-12-14 20:13:11 +0200
commitdbdfaafc447a4d09377619a7c824b87539453007 (patch)
treeded742089a2ae0e94cb93265c766e69341a4cbba /src/gameobject.js
parent13c5dc317abe0fb4458e703f2ab9397a7c24c859 (diff)
Make Xmas fork
Diffstat (limited to 'src/gameobject.js')
-rw-r--r--src/gameobject.js10
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
+}