Learn Create Your Own Split Screen

Next Page

To make the bird fall, we'll use this function:
function make_bird_slow_and_fall() { if (bird.velocity_y < max_fall_speed) { bird.velocity_y = bird.velocity_y + acceleration; } if (bird.y > myCanvas.height - bird.MyImg.height) { // gone off bottom bird.velocity_y = 0; game_mode = 'over'; } }
It simply says if the bird has not yet reached it's maximum fall speed, then increase it's downward velocity by the amount of acceleration we've selected.

If the bird's y-position is past the bottom of the canvas, then set the velocity back to zero, and we'll set a variable called game_mode to 'over', which will come in handy elsewhere.

Have a good look at the function and be sure you understand how it achieves its goal.

We're going to call this function from our main Do_a_Frame renderer.