In this video, you will program the clones to perform differently from one another.
When you test your code, both clones do exactly the same thing. They stay in the same position,wait for 3 seconds, and disappear.
Many studio logos perform an effect or animation before they center on the screen.
Program the “Studio Name” clone to run different code using conditional statements.
Drag out an “if” block. Next, drag out an “equals” block, andplace it in the “if” block. Place the “costume #” block in the first value box.
This block stores the number of the current costume. Type in the costume number of theclone you’re animating. This example animates the “Studio Name” costume, so “2”is entered into the “equals” block.
Next, animate a movement for your studio name.
You may have to “show” the sprite, and switch to the correct costume number, to dothis. This example uses a “go to x y” block and a “glide” block to make thewords fly in from the bottom, but you’ll create your own fun animation for your logo.
You can make your costume spin, zip around the screen, or fade in using an effect. Placethe entire “if” block after the “when I start as a clone” block.
Test it out. Both clones appear, and the “studio name” clone glides in from the bottom. However,the text now stays visible an additional second after the background disappears. In this example,the bug comes from the “glide” block. When the code for the “Studio Name” cloneruns, it moves to the bottom of the screen, glides 1 second, then waits 3 seconds. Thattakes 4 seconds to complete! The “opening screen” clone only waits 3 seconds beforeit hides. Rather than sequencing the different parallelcode stacks to stop at the same time, send an interrupt to stop the code from running.
Interrupts stop the code and make sprites do something different. In this case, usethe “broadcast” block to send an interrupt which will stop the studio animation and startthe new project. Drag out a broadcast block and attach it tothe bottom of the “when flag clicked” block stack. Create a new message and nameit “Start Program,” because this block will both delete the clones and start anynew projects.
Drag out a “when I receive” block, and change the dropdown to “start program.”
Move the “delete this clone” block to the “when I receive” block. Move the “wait”block to above the “broadcast” block. The “wait” block determines the lengthof time the studio logo runs before the broadcast block interrupts the animation and deletesthe clones.
Click the flag to test. Both clones should disappear after 3 seconds have passed. If3 seconds is too long or too short, tinker with the wait value. This example changesthe value to 4.
Now that you have one conditional statementand a way to make the animation end after a certain period of time, it will be easierto add more animations to your studio logo. The next video will show you how!
Now, it’s your turn:Program the “Studio Name” clone to run different code using “costume #,” “equals,” and “if” blocks.
Add an animation to the “Studio Name” clone.
Make the Studio Logo animation end using “broadcast” and “when I receive.”