How to Add Gravity to Your Flappy Bat Game
Why does the bat keep flying up until it reaches the top of the Stage in this simple Flappy Bat game? The following steps show one of the simplest ways to simulate gravity in your game.
Click the Player sprite and then click the Scripts tab.
Drag a third set of blocks into the Scripts Area to make the bat fall toward the ground.
Click the Green Flag button to test your code.
The player has to keep flapping or he or she will take a nosedive. Notice how there are now two sets of blocks that begin with WHEN GREEN FLAG CLICKED; part of Scratch’s power comes from being able to run several sets of code blocks all at the same time.
While you are still on the Scripts tab, you should add a GO TO block with X and Y values each set to 0 to reset the position of the Bat sprite to the center of the screen when the game begins.