From 36730f678208e75c3c97e881c331ed3490975026 Mon Sep 17 00:00:00 2001 From: "Patrick W. McMahon" Date: Wed, 5 Aug 2015 16:19:25 -0400 Subject: [PATCH] Update player.js fixed player moving after game over. --- examples/flappyBird/player.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/flappyBird/player.js b/examples/flappyBird/player.js index 1a87b66..c82e7c4 100644 --- a/examples/flappyBird/player.js +++ b/examples/flappyBird/player.js @@ -18,15 +18,18 @@ function Player(c,n,s){ } this.input = function(keys){ - this.upKey=32; - if(keys[this.upKey]){//up key - this.y-=this.speed; - if(this.y<0){ - this.y=0; + var gameState = this.gameEngine.getEventInStack("gameover",false); + if(gameState==false){ + this.upKey=32; + if(keys[this.upKey]){//up key + this.y-=this.speed; + if(this.y<0){ + this.y=0; + } + this.movingUp=true; + }else{ + this.movingUp=false; } - this.movingUp=true; - }else{ - this.movingUp=false; } }