From 8c70582bf01821f8a71910013372e3b12f06cdd3 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Wed, 10 Sep 2014 16:40:47 +0200 Subject: Swapped gamepads and corrected position of victory text --- game/states/play.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/game/states/play.js b/game/states/play.js index b866370..42d9a8f 100644 --- a/game/states/play.js +++ b/game/states/play.js @@ -25,8 +25,6 @@ Play.prototype = { 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); }, update: function() { @@ -113,11 +111,11 @@ Play.prototype = { } }, pollPlayerInput: function() { - if (this.game.input.gamepad.pad1.connected) { - this.pollAnalogStickForPlayer(this.game.input.gamepad.pad1, this.playerA); - } if (this.game.input.gamepad.pad2.connected) { - this.pollAnalogStickForPlayer(this.game.input.gamepad.pad2, this.playerB); + this.pollAnalogStickForPlayer(this.game.input.gamepad.pad2, this.playerA); + } + if (this.game.input.gamepad.pad1.connected) { + this.pollAnalogStickForPlayer(this.game.input.gamepad.pad1, this.playerB); } if (this.game.input.keyboard.isDown(this.playerAControls.up)) { @@ -396,7 +394,7 @@ Play.prototype = { }, setVictoryText: function(newText, winnerLetter) { this.victoryText = this.game.add.bitmapText(this.world.width/2/this.world.scale.x, 2, 'scorefont-'+winnerLetter, newText, 2); - this.victoryText.position.x = this.world.width/2/this.world.scale.x - this.victoryText.textWidth/2 - 0.5; + this.victoryText.position.x = (this.world.width/this.world.scale.x)/2 - 8 - this.victoryText.textWidth/2 - 0.5; }, shutdown: function() { this.game.input.keyboard.removeKey(this.playerAControls.up); -- cgit v1.2.3