Case 01: Get into Danger
2. Case 01: Get into Danger#
To create a magic wand that can beat over the spider.
With the sound of footfalls approaching in a quiet and dark gorge, Xiao En and his partners have left their magic school and got here for the first time. Suddenly a pair of red eyes shining in the grass in the front of them, oh, it is a guard of the insects! Let’s make a magic wand to expel the insects!
Click “Advanced” in the MakeCode drawer to see more choices.
We need to add a package for programming, . Click “Extensions” in the bottom of the drawer and search with “magicwand” in the dialogue box to download it. (Kindly note this package is still in the verifying process and pls search with “https://github.com/elecfreaks/pxt-magicwand “ before it’s ready)
Note: If you met a tip indicating that the codebase will be deleted due to incompatibility, you may continue as the tips say or build a new project in the menu.
Drag and set the magic level block as primary; and set the infrared sending connection to P1.
Drag the release magic once block into the while button P2 being pressed block as the picture shows.
Press the button to activate the magic and if the moving spider was hit by the magic, it turns over and stops moving.
How to play a sound while we use the magic.