So far, the main character has only performed actions that were included in the starterproject. The next two videos will show you how to create a new message and another actionfor the main character. First, program the main character to walk.
Click the main character to start. To make the main character look like it iswalking, use the “switch costume” block. There are two walking costumes,so drag out two “switch costume” blocks. From the dropdown menus, select “Walking1” and“Walking2.” Test the code by clicking the blocks a coupletimes. It looks like nothing’s happening between clicks. That’s because the computerexecutes one instruction after the other too quickly for you to see the change. To slowit down, place a “wait” block in between the two “switch costume” blocks. Now,you can see the costumes change.
Repeat this change with a repeat loop.
Test it by clicking the code. It works, but the main character kind of lookslike it’s twitching instead of walking. Read the code to understand why. It reads:“switch costume, wait, switch costume, and then switch costume again.” The program doesn’t pause beforerestarting the loop. Add another “wait” block after “switch to costume walking2.”
Test it. The main character’s walking looks less awkward now!
The main character looks like it’s walking, but it doesn’t go anywhere. Add some “move”blocks after the “switch costume” blocks to make the main character move while it walks.
Test it one more time! The main character walks backward! To fixthat, try making it move negative 10 steps instead of 10. Now, it walks in the directionit’s facing! Have fun tinkering with this code. Changehow far the main character walks by changing the number in the “move” blocks or inthe repeat loop. Change how fast the main character walks by changing the values inthe “wait” blocks.
In computer science, it often takes more than one try to find the right solution to a problem.
Keep coding, testing, and trying solutions until you find the one that works.
Now, it’s your turn: Use the “repeat,” “switch costume,”“wait,” and “move” blocks to make the main character walk.
Tinker with the values in the blocks until you like how the main character walks.
In the next step, you’ll broadcast a message from the narrator to make the main characterwalk.