From b4783ab327f290c4e4441a26a2ec2edfdb721175 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Thu, 30 Jul 2015 23:19:36 +0300 Subject: Add js-platformer. --- js-platformer/src/gameobject.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 js-platformer/src/gameobject.js (limited to 'js-platformer/src/gameobject.js') diff --git a/js-platformer/src/gameobject.js b/js-platformer/src/gameobject.js new file mode 100644 index 0000000..c7e47b4 --- /dev/null +++ b/js-platformer/src/gameobject.js @@ -0,0 +1,28 @@ +var GameObjectPrototype = function() { + this.texture = PIXI.Texture.fromImage("res/red.png"); + this.sprite = new PIXI.Sprite(this.texture); + + this.initPosition = function() { + this.sprite.anchor.x = 0.5; + this.sprite.anchor.y = 0.5; + + this.sprite.position.x = settings.STAGE_WIDTH * 0.5; + this.sprite.position.y = settings.STAGE_HEIGHT * 0.5; + } + + return this; +} + +var GameObject = function() { + + this.initPosition(); + Engine.instance.addGameObject(this); + + this.update = function() { + + } + + return this; +} + +GameObject.prototype = new GameObjectPrototype(); \ No newline at end of file -- cgit v1.3