summaryrefslogtreecommitdiff
path: root/game/prefabs
diff options
context:
space:
mode:
authorJustin Worthe <justin.worthe@entelect.co.za>2014-05-14 12:18:39 +0200
committerJustin Worthe <justin.worthe@entelect.co.za>2014-05-14 12:18:39 +0200
commit98e5b9470fdc102765a289078b3967e3d94fcae0 (patch)
treecd5436269ce5a40486b0b4fc039f62cb49959dcb /game/prefabs
parenta5ab29fd2d015f2db65d8062d2bb23222859b6d1 (diff)
Added pill to the world and set object anchors to their center
re #4
Diffstat (limited to 'game/prefabs')
-rw-r--r--game/prefabs/pill.js20
-rw-r--r--game/prefabs/player.js1
-rw-r--r--game/prefabs/wall.js1
3 files changed, 22 insertions, 0 deletions
diff --git a/game/prefabs/pill.js b/game/prefabs/pill.js
new file mode 100644
index 0000000..2df13f2
--- /dev/null
+++ b/game/prefabs/pill.js
@@ -0,0 +1,20 @@
+'use strict';
+
+var Pill = function(game, x, y, frame) {
+ Phaser.Sprite.call(this, game, x, y, 'pill', frame);
+ this.scale = {x: 0.01, y: 0.01};
+ this.anchor = {x: 0.5, y: 0.5};
+ // initialize your prefab here
+
+};
+
+Pill.prototype = Object.create(Phaser.Sprite.prototype);
+Pill.prototype.constructor = Pill;
+
+Pill.prototype.update = function() {
+
+ // write your prefab's specific update code here
+
+};
+
+module.exports = Pill;
diff --git a/game/prefabs/player.js b/game/prefabs/player.js
index a195f94..1336003 100644
--- a/game/prefabs/player.js
+++ b/game/prefabs/player.js
@@ -5,6 +5,7 @@ var Player = function(game, x, y, key, frame) {
this.moving = false;
this.scale = {x: 0.01, y: 0.01};
+ this.anchor = {x: 0.5, y: 0.5};
};
Player.prototype = Object.create(Phaser.Sprite.prototype);
diff --git a/game/prefabs/wall.js b/game/prefabs/wall.js
index 11ca511..c4eee79 100644
--- a/game/prefabs/wall.js
+++ b/game/prefabs/wall.js
@@ -3,6 +3,7 @@
var Wall = function(game, x, y, frame) {
Phaser.Sprite.call(this, game, x, y, 'wall', frame);
this.scale = {x: 0.01, y: 0.01};
+ this.anchor = {x: 0.5, y: 0.5};
};
Wall.prototype = Object.create(Phaser.Sprite.prototype);