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 the same position, wait for three 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 codes using conditional statements.
Drag out an If block.
Next, drag out an Equals block,
and place it in the If block.
Place the Costume Number block in the first value box.
This block stores the number of the current costume.
Type in the costume number of the clone you're animating.
This example animates the studio name costume,
so two 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 do this.
This example uses a Go-To X, Y block and a Glide block
to make the words 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.
Place the 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
for an additional second after the background disappears.
In this example, the bug comes from the Glide block.
When the code for the studio name clone runs,
it moves to the bottom of the screen,
glides one second, then waits three seconds.
That takes four seconds to complete.
The opening screen clone only waits three seconds
before it hides.
Rather than sequencing the different
parallel code 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, use the Broadcast block
to send an interrupt,
which will stop the studio animation,
and start the new project.
Drag out a Broadcast block,
and attach it to the bottom of the
When Flag Clicked block stack.
Create a new message and name it start program
because this block will both delete the clones,
and start any new projects.
Drag out a When I Receive block,
and change the drop down to start program.
Move the Delete This Code block
to the When I Receive block.
Move the Wait block to above the Broadcast block.
The Wait block determines the length of time
the studio logo runs
before the Broadcast block interrupts the animation
and deletes the clones.
Click the flag to test.
Both clones should disappear
after three seconds have passed.
If three seconds is too long, or too short,
tinker with the wait value.
This example changes the value to four.
Now that you have one conditional statement
and a way to make the animation end
after a certain period of time,
it will be easier to 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 Number,
Equals, and If blocks.
Add an animation to the Studio Name clone.
Make the Studio Logo animation end using
Broadcast and When I Receive blocks.