Sunday, May 12, 2013

Scratch 2.0 is Here!

   Scratch 2.0 is now out! It’s browser-based at this point in time but I checked and found out that the developers are hoping to have a down-loadable version sometime this summer. I often work away from the Internet so I will not be shifting to Scratch 2.0 until I have a downloaded copy.
   That doesn’t mean I am not exploring the new features in Scratch 2.0. My  favorite ‘new feature’ is the ability to Make a Block.
   As a Logo-Lover, the 'Make a Block' ability in Scratch 2.0 let's me shorten code so that the logic of a program is easier to follow (and debug). 'Make a Block' is called a 'procedure' in Logo. Simply put, you can define a long script and give it a single name and them use only the ‘name’ in the main script.
   I programmed an example using a piece of useful code in The Golden Rectangle project described in the previous post. The equiangular spiral drawn in that project uses a script that draws the arc of a circle given the radius and arc (in degrees). I defined that script using Make a Block and then use just that name in the main script.
   Here's a picture of the scripts. 
   Notice that the Green Flag script only contains two blocks, the names of the defined purple-topped blocks.  Sliders provide the inputs to radius and arc.
   Here’s how the project works.
   Using the origin (0, 0) as the center of a circle, set the arc length and radius parameters of the circle with the sliders.
   Click on the green flag to see the circle or arc you set in the sliders.
   You can download a copy of this program (not Scratch.20) that can then be uploaded into the browser or you can just stay in the browser to make arcs. Here's the link.

No comments:

Post a Comment