mirror of
https://github.com/danbulant/bobek
synced 2026-07-06 11:30:43 +00:00
touch ground fixed
This commit is contained in:
parent
723e97214f
commit
1d6c48dd93
1 changed files with 4 additions and 2 deletions
6
game.js
6
game.js
|
|
@ -4,12 +4,13 @@
|
||||||
switch (state.curr) {
|
switch (state.curr) {
|
||||||
case state.getReady :
|
case state.getReady :
|
||||||
state.curr = state.Play;
|
state.curr = state.Play;
|
||||||
bird.x = bird.x*4;
|
|
||||||
break;
|
break;
|
||||||
case state.Play :
|
case state.Play :
|
||||||
bird.flap();
|
bird.flap();
|
||||||
break;
|
break;
|
||||||
case state.gameOver :
|
case state.gameOver :
|
||||||
|
state.curr = state.getReady;
|
||||||
|
bird.y = 100;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -90,11 +91,12 @@
|
||||||
this.speed += this.gravity;
|
this.speed += this.gravity;
|
||||||
let r = parseFloat( this.animations[0].sprite.height);
|
let r = parseFloat( this.animations[0].sprite.height);
|
||||||
console.log(r);
|
console.log(r);
|
||||||
if(this.y + r > gnd.y)
|
if(this.y + r >= gnd.y)
|
||||||
state.curr = state.gameOver;
|
state.curr = state.gameOver;
|
||||||
break;
|
break;
|
||||||
case state.gameOver :
|
case state.gameOver :
|
||||||
this.frame = 1;
|
this.frame = 1;
|
||||||
|
this.speed = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.frame = this.frame%this.animations.length;
|
this.frame = this.frame%this.animations.length;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue