summaryrefslogtreecommitdiff
path: root/game/prefabs/hud.js
diff options
context:
space:
mode:
authorJustin Worthe <justin.worthe@gmail.com>2014-09-21 10:31:48 +0200
committerJustin Worthe <justin.worthe@gmail.com>2014-09-21 10:31:48 +0200
commitc508e9ef283a4069ea1af923ca1a241d2c954a1e (patch)
tree930f8ad620fdde4e1668cd1909fc9eaca35fcae1 /game/prefabs/hud.js
parent48049a71ab041d8b109e2a7a12a8439ed3be812a (diff)
Renamed prefab folder
Diffstat (limited to 'game/prefabs/hud.js')
-rw-r--r--game/prefabs/hud.js50
1 files changed, 0 insertions, 50 deletions
diff --git a/game/prefabs/hud.js b/game/prefabs/hud.js
deleted file mode 100644
index a7b39a0..0000000
--- a/game/prefabs/hud.js
+++ /dev/null
@@ -1,50 +0,0 @@
-'use strict';
-
-var Hud = function(game, player, x, y, scorefontKey, keyboardSpriteKey) {
- Phaser.Group.call(this, game);
- this.x = x;
- this.y = y;
- this.player = player;
- this.scale = {x: 0.02, y: 0.02};
-
-
- this.background = new Phaser.Sprite(this.game, 0, 0, 'hud-bg');
- this.add(this.background);
- this.scoreText = new Phaser.BitmapText(this.game, 172, 10, scorefontKey, '0', 100);
- this.add(this.scoreText);
-
- this.poisonIndicator = new Phaser.Sprite(this.game, 200, 150, 'poison-pill');
- //this.poisonIndicator.scale = {0.1, 0.1};
- this.poisonIndicator.anchor = {x:0.5, y:0.5};
- this.add(this.poisonIndicator);
-
- this.controllerDiagram = new Phaser.Sprite(this.game, 0, 300, 'controller-diagram');
- this.controllerDiagram.scale = {x: 0.5, y: 0.5};
- this.add(this.controllerDiagram);
-
- this.keyboardControls = new Phaser.Sprite(this.game, 0, 600, keyboardSpriteKey);
- this.keyboardControls.scale = {x: 0.5, y: 0.5};
- this.add(this.keyboardControls);
-
- this.currentScore = 0;
-};
-
-Hud.prototype = Object.create(Phaser.Group.prototype);
-Hud.prototype.constructor = Hud;
-
-Hud.prototype.update = function() {
- if (this.currentScore !== this.player.score) {
- this.currentScore = this.player.score;
- this.scoreText.setText(this.player.score+'');
-
- var numberOfDigits = Math.floor(Math.log(this.currentScore)/Math.log(10))+1;
- this.scoreText.x = 200 - numberOfDigits*30;
- }
-
- if (this.poisonIndicator && !this.player.hasPoisonPill) {
- this.poisonIndicator.destroy();
- this.poisonIndicator = null;
- }
-};
-
-module.exports = Hud;