From 920eccd0fe8a8acc6ff03f4333a400a9782f6d1a Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Thu, 17 Jul 2014 19:23:25 +0200 Subject: Added bonus pill and bumped phaser version --- game/states/play.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'game/states/play.js') diff --git a/game/states/play.js b/game/states/play.js index a2d7edf..ca259b4 100644 --- a/game/states/play.js +++ b/game/states/play.js @@ -1,8 +1,9 @@ 'use strict'; -var Wall = require('../prefabs/wall'); var Player = require('../prefabs/player'); var Pill = require('../prefabs/pill'); +var BonusPill = require('../prefabs/bonusPill'); +var Wall = require('../prefabs/wall'); function Play() {} @@ -86,6 +87,9 @@ Play.prototype = { case '.': this.pills.add(new Pill(this.game, x, y)); break; + case '*': + this.pills.add(new BonusPill(this.game, x, y)); + break; case 'A': this.playerA = new Player(this.game, x, y, 'player-a', 0); this.players.add(this.playerA); @@ -109,7 +113,7 @@ Play.prototype = { left: Phaser.Keyboard.A, down: Phaser.Keyboard.S, right: Phaser.Keyboard.D - } + }; this.playerBControls = { up: Phaser.Keyboard.UP, left: Phaser.Keyboard.LEFT, @@ -147,7 +151,7 @@ Play.prototype = { } }, playerPillCollision: function(player, pill) { - player.score++; + player.score += pill.score; pill.destroy(); this.playerAScoreText.setText(this.playerA.score+''); -- cgit v1.2.3