Add Flapping Wings Animation to Your Flappy Bat Game - dummies

Add Flapping Wings Animation to Your Flappy Bat Game

By Derek Breen

If you click the Player sprite in Scratch and then click the Costumes tab, you should see two costumes: one with wings up and one with wings down. If you click each costume, you will see the Player bat flapping its wings on the Stage. If you want the bat to keep flapping its wings, you need to add some code blocks.

Click the Scripts tab and you see ten categories listed: Motion, Events, and so on. Notice how all the blocks in each category are the same color.


As you follow the steps below, use the color of each block shown in the image to guide you toward the category where you will find it on the Scripts tab.

  1. Select the Player sprite by clicking once on its icon beneath the Stage.

  2. Click the Scripts tab.

  3. Drag the following blocks into the Scripts Area and snap each one into place:


  4. Click the Green Flag button on the top of the Stage to test your code.


    Your bat should be flapping awfully fast. How do you slow it down?

  5. Click the Stop button (beside the Green Flag button) to stop the code from running.


    See how the NEXT COSTUME block is inside a FOREVER block? You need to add another block inside that FOREVER block to slow it down. Can you find the right block in the Control category (same color as the FOREVER block)?

  6. Drag and snap a WAIT block inside the FOREVER block; then click the Green Flag button again to test your code.


Now the bat is flapping too slowly, right? (This is beginning to feel like Goldilocks and the Three Bears!) What can you change if you want the wings to flap faster than 1 time every 1 second?

By default, the WAIT block has a value of 1. The white background means you can click and type to change the value. Try changing the value from 1 secs (seconds) to .2 secs, then click the Green Flag button again to test the change in your code.


How does it look? You can adjust the WAIT SECS to whatever value works best for you because YOU are the GAME DESIGNER!