summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Worthe <justin.worthe@entelect.co.za>2014-07-24 10:52:07 +0200
committerJustin Worthe <justin.worthe@entelect.co.za>2014-07-24 10:52:07 +0200
commit69f6a4f070753181fb174e5a103a82f990df64f9 (patch)
tree37fec171437c64c17a22c6ffea767105663aed06
parentfd8280fa577fab0d4deadb09bf183a364c0ec05f (diff)
Made fonts red and yellow for different players
-rw-r--r--assets/fonts/scorefont-a.pngbin0 -> 66265 bytes
-rw-r--r--assets/fonts/scorefont-b.pngbin0 -> 55207 bytes
-rw-r--r--assets/fonts/scorefont.pngbin42710 -> 0 bytes
-rw-r--r--assets/levels/maze.lvl2
-rw-r--r--game/states/play.js16
-rw-r--r--game/states/preload.js7
6 files changed, 14 insertions, 11 deletions
diff --git a/assets/fonts/scorefont-a.png b/assets/fonts/scorefont-a.png
new file mode 100644
index 0000000..04ab485
--- /dev/null
+++ b/assets/fonts/scorefont-a.png
Binary files differ
diff --git a/assets/fonts/scorefont-b.png b/assets/fonts/scorefont-b.png
new file mode 100644
index 0000000..e08f5a5
--- /dev/null
+++ b/assets/fonts/scorefont-b.png
Binary files differ
diff --git a/assets/fonts/scorefont.png b/assets/fonts/scorefont.png
deleted file mode 100644
index 0b34395..0000000
--- a/assets/fonts/scorefont.png
+++ /dev/null
Binary files differ
diff --git a/assets/levels/maze.lvl b/assets/levels/maze.lvl
index e2d2a3e..4d59c43 100644
--- a/assets/levels/maze.lvl
+++ b/assets/levels/maze.lvl
@@ -8,7 +8,7 @@
####.###.#.###.####
####.#.......#.####
####.#.## ##.#.####
- B...# #...A
+# B...# #...A #
####.#.## ##.#.####
####.#.......#.####
####.#.#####.#.####
diff --git a/game/states/play.js b/game/states/play.js
index 173564b..9a0748c 100644
--- a/game/states/play.js
+++ b/game/states/play.js
@@ -43,8 +43,8 @@ Play.prototype = {
this.game.physics.startSystem(Phaser.Physics.ARCADE);
- this.playerAScoreText = this.game.add.bitmapText(-0.1, -0.4, 'spaced-scorefont','0',1);
- this.playerBScoreText = this.game.add.bitmapText(this.world.width/this.world.scale.x - 2.1, -0.4, 'spaced-scorefont','0',1);
+ this.playerAScoreText = this.game.add.bitmapText(-0.1, -0.4, 'spaced-scorefont-a','0',2);
+ this.playerBScoreText = this.game.add.bitmapText(this.world.width/this.world.scale.x - 3.1, -0.4, 'spaced-scorefont-b','0',2);
this.gameWon = false;
},
@@ -54,13 +54,14 @@ Play.prototype = {
if (!this.gameWon && this.pills.total === 0) {
this.gameWon = true;
if (this.playerA.score > this.playerB.score) {
- this.setVictoryText("PLAYER A WINS");
+ this.setVictoryText('RED WINS', 'a');
}
else if (this.playerA.score < this.playerB.score) {
- this.setVictoryText("PLAYER B WINS");
+ this.setVictoryText('YELLOW WINS', 'b');
}
else {
- this.setVictoryText("DRAW");
+ var victoryColor = this.playerA.isMyTurn ? 'b' : 'a';
+ this.setVictoryText('DRAW', victoryColor);
}
var self = this;
@@ -207,10 +208,9 @@ Play.prototype = {
for (var i=0; i<this.players.children.length; ++i) {
this.players.children[i].isMyTurn = (i === this.playerTurn);
}
- console.log("Player " + this.playerTurn + "'s turn");
},
- setVictoryText: function(newText) {
- this.victoryText = this.game.add.bitmapText(this.world.width/2/this.world.scale.x, 2, 'scorefont', newText, 1);
+ 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;
},
shutdown: function() {
diff --git a/game/states/preload.js b/game/states/preload.js
index 2ffc179..0797077 100644
--- a/game/states/preload.js
+++ b/game/states/preload.js
@@ -18,8 +18,11 @@ Preload.prototype = {
this.load.image('pill', 'assets/images/pill.svg');
this.load.image('bonus-pill', 'assets/images/bonus-pill.svg');
- this.load.bitmapFont('spaced-scorefont', 'assets/fonts/scorefont.png', 'assets/fonts/scorefont.fnt', undefined, 10);
- this.load.bitmapFont('scorefont', 'assets/fonts/scorefont.png', 'assets/fonts/scorefont.fnt');
+ this.load.bitmapFont('spaced-scorefont-a', 'assets/fonts/scorefont-a.png', 'assets/fonts/scorefont.fnt', undefined, 10);
+ this.load.bitmapFont('scorefont-a', 'assets/fonts/scorefont-a.png', 'assets/fonts/scorefont.fnt');
+
+ this.load.bitmapFont('spaced-scorefont-b', 'assets/fonts/scorefont-b.png', 'assets/fonts/scorefont.fnt', undefined, 10);
+ this.load.bitmapFont('scorefont-b', 'assets/fonts/scorefont-b.png', 'assets/fonts/scorefont.fnt');
this.load.text('level', 'assets/levels/maze.lvl');
},