touch ground fixed

This commit is contained in:
Darkin 2019-10-19 11:13:48 +02:00
parent 723e97214f
commit 1d6c48dd93

View file

@ -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;