Now we can code to make the owl dance. Since you are a curious mind, you may find out the owl moves around and then stops according to your programming. So how should you change the code to make it dance without break?
Here we will use loop blocks.
Loop blocks instruct the owl to execute a motion iteratively.
Loop blocks are in Control category:
Here are three types of loop here: repeat, forever and repeat until.
If we want the owl to keep dancing, we need forever block.
- Add the Event block
- Choose the Motion category and drag the block
to Scripts area and change the number of the steps to 20
- Choose the Sound category and drag the block
to Scripts area
- Again, choose the Motion category and drag the block
to Scripts area and change the number of the steps to -20
- Add the loop block
Please note that after you add the loop block, if you feel the owl moves too fast, you can then use the block to allow the owl to stop for a while. Then check the programming result please!
Besides using the loop block, there are many other types of blocks in Control category of course. If you keep exploring blocks in Control category in Codecraft, you may find out more conditions for you to program. For example, you can use blocks to instruct the owl to repeat a movement for a certain times and add some conditional judgements to control the operation. That’s pretty fun isn’t it?