-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathhud.js
26 lines (20 loc) · 974 Bytes
/
hud.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use strict';
var HUD = function() {
Phaser.Sprite.call(this, game, 0, 416, 'hud', 0);
var textSize = 26;
var y = 435;
this.fixedToCamera = true;
this.levelLabel = game.add.bitmapText(35, y, uiFonts.HUD, 'Level: ' + game.global.level.toString(), textSize);
game.add.bitmapText(230, y, uiFonts.HUD, 'Moves: ', textSize);
this.movesLabel = game.add.bitmapText(340, y, uiFonts.HUD, game.global.moves.toString(), textSize);
game.add.bitmapText(515, y, uiFonts.HUD, 'x', textSize);
this.virusesLabel = game.add.bitmapText(550, y, uiFonts.HUD, groups.viruses.length.toString(), textSize);
this.menuLabel = bitmapTextCentered(400, uiFonts.INSTRUCTIONS, 'Press ESC for menu', 14);
groups.hud.add(this);
};
HUD.prototype = Object.create(Phaser.Sprite.prototype);
HUD.prototype.constructor = HUD;
HUD.prototype.update = function() {
this.movesLabel.setText(game.global.moves.toString());
this.virusesLabel.setText(groups.viruses.length.toString());
};