I wanted to continue my rave about Scratch 2.0 by talking you through how to use the new "make a block" feature. Those of you who've programmed with me using Alice 2.3 know what a fan I am of creating "custom methods", where you can put together a series of animation actions for a character into 1 programming "package" that you can name anything you want, and drag into your code wherever you want without having to program all those lines over and over. In real world programming, we call these "stored procedures" that you "call" within your code when you want specific actions to happen. You use this strategy to make your programming easier to follow and to standardize actions you want to repeat at different points within a coding sequence. "Make a block" in Scratch 2.0 is the same concept. When you have your character active and click on "more blocks", a pop up window appears. It's at this point you make some basic development decisions about what you want this block to do to control your character. All the decisions it prompts can be changed later by right clicking the block<edit. For example, this pop-up editor will give you the options to:
**add number input
**add string input
**add boolean input
**add label text
and asks you if you want run without screen refresh (it defaults to "unchecked")
The simplest way to play around with this feature is to click on the "add label text", which is what you want to name the custom action you want it to control. Be descriptive! For example, "10 second fast ball bounce". Once you've named this custom block, you'll see your new block on the left sidebar, and you'll also see a "define <name of your new custom block>" appear in your editor screen. This is where you add the animation scripting, like you normally would, from the standard Scratch blocks. Once you've "defined" your custom block, you can drag and snap it from the left side bar into your code (tip: just defining it doesn't make the action happen. You also have to drag the new block over into your code.)
I'm working on a lesson plan to show how and when you'd program all 4 of the options, add/edit definitions and when to run with and without the screen refresh, and I'll add a link to it in next week's post.
No comments:
Post a Comment