When the green flag is clicked, set the score variable to 0 , switch to the costume with the
bat wings up, set the size to be 10 percent of the original sprite size, go to the topmost
layer, and then move to those x and y positions. Play around by changing the size of your
bat and experimenting with the x and y positions. Changing these will affect the difficulty
of your game.
Now, we enter our forever loop. Each time this loop occurs, we set the sprite to be the bat
with wings up, and move it down by 1 on the stage. This next block introduces us to user
input. It says that if the space key is pressed on your keyboard, then it should switch to the
bat with wings down and move up the stage by 5 . You can change the key to be anything
on your keyboard. You can also change the 5 to increase or decrease the height at which
the bat flies per button press.
The next two if blocks follow the same formula. If your bat sprite touches Floor1,
Floor2, or the pipes, then Game Over will appear next to the sprite and the game will
Finally, if the x position of the bat is equal to the value of pipeX , then you should change
the score by 1 , since it indicates that you have passed through one of the pipes success-
Now, try out your game!