Skip to content

Commit

Permalink
Update player.js
Browse files Browse the repository at this point in the history
fixed player moving after game over.
  • Loading branch information
Patrick-W-McMahon committed Aug 5, 2015
1 parent 50490de commit 36730f6
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions examples/flappyBird/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 36730f6

Please sign in to comment.