diff options
Diffstat (limited to 'game')
-rw-r--r-- | game/prefabs/hud.js | 6 | ||||
-rw-r--r-- | game/states/play.js | 4 | ||||
-rw-r--r-- | game/states/preload.js | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/game/prefabs/hud.js b/game/prefabs/hud.js index 13f8f51..a7b39a0 100644 --- a/game/prefabs/hud.js +++ b/game/prefabs/hud.js @@ -1,6 +1,6 @@ 'use strict'; -var Hud = function(game, player, x, y, scorefontKey) { +var Hud = function(game, player, x, y, scorefontKey, keyboardSpriteKey) { Phaser.Group.call(this, game); this.x = x; this.y = y; @@ -22,7 +22,9 @@ var Hud = function(game, player, x, y, scorefontKey) { this.controllerDiagram.scale = {x: 0.5, y: 0.5}; this.add(this.controllerDiagram); - this.sendToBack(this.background); + 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; }; diff --git a/game/states/play.js b/game/states/play.js index 9c5a91c..b866370 100644 --- a/game/states/play.js +++ b/game/states/play.js @@ -23,8 +23,8 @@ Play.prototype = { this.gameWon = false; - this.hudA = new Hud(this.game, this.playerA, this.gameWidth-0.5, -0.5, 'spaced-scorefont-a'); - this.hudB = new Hud(this.game, this.playerB, -8.5, -0.5, 'spaced-scorefont-b'); + this.hudA = new Hud(this.game, this.playerA, this.gameWidth-0.5, -0.5, 'spaced-scorefont-a', 'keys-a'); + this.hudB = new Hud(this.game, this.playerB, -8.5, -0.5, 'spaced-scorefont-b', 'keys-b'); //this.game.add.existing(this.hudA); //this.game.add.existing(this.hudB); diff --git a/game/states/preload.js b/game/states/preload.js index f47b62d..95ceb96 100644 --- a/game/states/preload.js +++ b/game/states/preload.js @@ -33,6 +33,8 @@ Preload.prototype = { this.load.image('hud-bg', 'assets/images/hud-bg.svg'); this.load.image('controller-diagram', 'assets/images/controller-diagram.svg'); + this.load.image('keys-a', 'assets/images/keyboard-control-a.svg'); + this.load.image('keys-b', 'assets/images/keyboard-control-b.svg'); }, create: function() { this.asset.cropEnabled = false; |