One of the most common frustrations I see with students is getting sprites back “home” after they run their creations.
Students oftentimes will reset their sprites manually, dragging them back to where they want them to be before they hit that start button.
With a little explanation and planning you can guide them to get those sprites “home” correctly; we’ll explore a few common things they’ll need to do as their project levels advance.
First, lets learn to walk!
Lets suppose to start that you put in some code to make your sprite glide across the screen like so:
The problem is.. this only works the very first time you do it. Your sprite is stuck at the destination and clicking the green flag a second time does nothing.
This is where you’ll often see your students grabbing the sprites on the stage and moving them back each time — the ideal learning opportunity.
Have them reflect on what needs to happen at the start of their project. See if you can guide them to thinking that at the beginning of the project they want their sprite to be in a specific place at the start. Perhaps — “So where do you want the sprite to start from?”.. .”Oh there, ok”.. “Is there another way you can have the sprite go to that location with code without dragging it there?”.. “A moveto block! Perfect, that will make it go there immediately at the start without even a blink of the eye”.
Another great tip is that the blocks of code in the main area update with the location you drag your sprite to. Have them position it where they want it to start and drag out a moveto block like so:
Now, lets go for a jog
Now, as the students projects get more advanced it’s important to “initialize” all the characteristics of our sprites that we might change during our program.
Here’s an example where we change the backdrop at the end of the project, we make our character costume change and the color effect on our character also changes after they reach their destination along with some other effects.
We have the same problem though as before. When we hit the green flag this only seems to work the first time. We have to reset the attributes of our character. ITCH helps us out a little, when you hit the green flag, it resets some of the attributes such as the graphic effects and the whatever our sprite was saying. However, the backdrop and the size and costume have to be set back to their “home” or starting condition. For now we are going to reset everything we change to get this working; to learn why, read on to our “Finally, we can sprint”, below.
Now we’re talking! This resets every one of our sprites attributes that we change in our program, so every time we run it, it first is put back to it’s initial state or “goes home”.
|