A Panda Counting Off

This project will use the Sensing block gyro sensor (1) shaken?

When the gyro sensor detects any vibration ( it can sense motions like shaking or tapping the table), the output value will be true. If the gyro sensor fails to detect any vibration, the output value will be false.

In this project, we will use variables to have the Panda report the shaking strength detected by the Gyro block.

We need the [Gyro] block.

Program the gyro

1. Select Variables block, and click "Make a variable". Name the variable "Shaking Strength".

2. Drag an Events block when green flag clicked to the Scripts Area, and then add a Variables block Set (Shaking Strength) to (0)

3. Add a Control block if () then (), a Sensing block gyro sensor (1) shaken?, and a Variables block change (Shaking Strength) by (1)

4. Add a Control block forever

Program the panda

5. Select "Panda" under "Sprites"

Note: you can select another sprite, too.

6. Drag an Events block when green flag clicked, a Looks block say (), and put the Variables block Shaking Strength inside the Looks block.

7. Add a Control block forever

8. Click the green flag to run the program. Then tap the table with your hands. See what happens?

This program can make a fun game. Compete with your friends to see who can get the best score within a given period of time.

results matching ""

    No results matching ""