arrow_back Make an Entrance
In this add-on, you'll program the sprite to make an impressive entrance.
To start, program the sprite to start off stage, then glide on stage when the program starts. Drag the sprite to the edge of the stage, and add a "go to" block from the motion menu under the "when flag clicked" event. Drag the sprite to the middle of the stage, and add a "glide" block under the "go to" block. Click the flag to test. Tinker with the number in the seconds value to make the sprite move faster or slower. This example uses 3 seconds.
Next, program the sprite to turn and change color. Add a “turn” block and from looks, add a "change color effect" block to the scripts area. Click the block stack to test. Cool!
Make the sprite repeatedly turn and change color for a set amount of time. To do this, select the control menu, and add a "repeat until" block around the block stack. To make the sprite turn and change color until a certain amount of time has passed since the program started, use an operator. Click the operators menu, and add a "greater than" block. From the sensing menu, add a "timer" block to the left side of the "greater than" operator.
In the right side, type a number. This example uses 3 seconds, which is the same amount of time that the sprite glides on the stage. Tinker with the number in the "greater than" block to make the sprite spin for a longer or shorter amount of time. From the events menu, add a "when flag clicked" event. Click the flag to test.
Whoa! That looks cool, but the sprite ends up at an angle.
To make the sprite stand straight up, add a "point in direction" block from the Motion menu. Make sure 90 is selected in the dropdown menu. Click the flag to test.
That's better, but the sprite is still a different color. To return the sprite to its original color, select looks, and add a "clear graphic effects" block under the "repeat until" block stack. Click the flag to test again.
Awesome! The sprite spins, changes color, and glides on stage, then returns to its original color and faces upright. Now, it's your turn.
Program the sprite to glide on stage. Make the sprite repeatedly spin and change color for a set amount of time using the "repeat until," "greater than," "timer," "turn," and "change color" blocks. Program the sprite to change back to its original color and stand upright using the "clear graphic effects" and "point in direction" blocks.