The first
glitch is when the bird
hits a pipe, the bird
keeps on doing whatever it was doing.
If the bird happened to be going up at that moment, then the "game over" message will appear and behind it the bird will continue drifting upward. Very bizarre.
If you didn't notice it, go back and play the game a few times and see if you can make it happen.
The solution is that when we're rendering frames when the game is over, we still need to execute our falling bird logic.
function Do_a_Frame () {
ctx.clearRect(0, 0, myCanvas.width, myCanvas.height);
bird.Do_Frame_Things();
display_bar_running_along_bottom();
switch (game_mode) {
case 'prestart': {
display_intro_instructions();
break;
}
case 'running': {
frame_count++;
time_game_last_running = new Date();
show_the_pipes();
make_bird_tilt_appropriately();
make_bird_slow_and_fall();
check_for_end_game();
break;
}
case 'over': {
make_bird_slow_and_fall();
display_game_over();
break;
}
} // switch
}