In this add-on, you will make the sprite move through several backdrops to demonstrate thatthe fitness gadget can work in many different environments.
Begin by adding several backdrops. To do this, click the stage, open the “Backdrops”tab, and click “choose backdrop from library.” Click the backdrop you want to add, then click“OK.” Repeat this until you have about 3 new backdrops.
Next, program the android sprite to glide from one backdrop to the next. Select theandroid sprite, then open the “scripts” tab. Click the “motion” menu.
Drag the android to the right edge of the stage. When you let go of the mouse, the valuesin the “glide” block update to reflect the sprite’s current position. Drag outthe “glide” block. Move the android sprite back to its starting point, then click theglide block to test it out. Cool! The android glides to that spot.
To create the illusion that the android is traveling through different environments,add code to switch the backdrop and reset the android back to the left side. Open the“looks” menu, and add a “switch backdrop” block to the stack. Change the dropdown menuto “next backdrop.” Then, drag the sprite to the left edge of the stage, and add a “goto” block from the “motion” menu to the stack.
Click this stack to test it out.
Cool! It looks like the android travels to a new place.
Every time the stack is clicked, the android goes somewhere different.
Add a “repeat” loop around this stack to make this animation happen over and overagain without having to click the stack multiple times. Click it to test it out.
Tinker with the value in the “glide” block to make the android move faster or slower.
Change the value in the “repeat” loop to match the number of backdrops you added,so that the android visits each location once. Test your code often when tinkering.
Right now, this animation ends awkwardly with the android off the left edge of the stage.
Add some code to make the android end in a more natural spot. This example uses two “glide”blocks to make the android move left, and then up. What you do is up to you!
Incorporate this animation into your commercial by adding a “when I receive” block tothe top of the stack. Use a descriptive message, like “change scene.” Then, add at leastone “broadcast and wait” block to the “when flag clicked” stack, in the placewhere the animation will happen.
Finish by adding a “say” block to the beginning of the “change scene” animation,so the viewer knows what the android’s about to do. This example says “It also worksin different geographic areas!” Test the commercial by clicking the flag.
Here’s the Game Plan! Add some more backdrops.
Program the android sprite to look like it’s moving through different environments usingthe “glide,” “switch backdrop,” “go to,” and “repeat” blocks.
Complete the end of the animation using more “glide” blocks.
Add a “say” block to introduce this segment. Incorporate this animation into the commercialusing a “broadcast and wait” block and a “when I receive” block.
Choisir une extension
Programmer le lutin pour qu'il danse.
Changement de scène
Fais passer l'androïde sur différentes scènes pour voir comment le gadget réagit.
Ajoute des effets météorologiques pour montrer la solidité du gadget.
Demande à l'acheteur d'acheter l'objet.
Ajoute au projet d'autres lutins qui interagiront avec l'athlète.
Code le lutin pour lui ajouter un pouls et pour le faire parler de son rythme cardiaque.