|This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.|
|Change Stretch by ()|
The Change Stretch by () block was a Looks block and a Stack block. It made the sprite stretch horizontally. The stretch would reset when adjusting the size of a sprite. It was removed in an early version of Scratch for unknown reasons and made an obsolete block. This block is not in Scratch 2.0 anymore, but is still usable in the Scratch 1.4 offline editor.
There is no workaround using only blocks, but one can repeatedly duplicate costumes in the paint editor, stretching each one slightly more than the last to create the effect. The first costume can be designed to have no stretch, and the last costume can have the maximum stretch. The costumes can then be iterated in order to create the visual effect of a sprite stretching. The following script implies that there are 100 costumes in the sprite:
define change stretch by (n) if <((costume #) + (n)) > > then switch costume to [costume 100 v] else if <((costume #) + (n)) < > then switch costume to [costume 1 v] else switch costume to ((costume #) + (n)) end end
However, the above script may not completely replicate the block since it depends on the stretch difference between each sprite along with the total number of costumes. Since making many costumes can be a daunting task, ten costumes, for instance, can be used instead. It is also best to use a variable to keep track of the actual "stretch" value. A variable called "stretch" can be used for this. and the following script can be used instead.
|Note:||"0" is the minimum stretch, "100" is the maximum.|
define change stretch by (n) with (num_costumes) number of costumes change [stretch v] by (n) if <(stretch) > > then set [stretch v] to  end if <(stretch) < > then set [stretch v] to  end switch costume to ([ceiling v] of ((stretch) / (num_costumes)))
Say () for () Secs • Say () • Think () for () Secs • Think () • Switch Costume to () • Next Costume • Switch Backdrop to () Next Backdrop • Change Size by () • Set Size to ()% • Change () Effect by () • Set () Effect to () • Clear Graphic Effects • Show • Hide • Go to () Layer • Go () () Layers • Costume # • Backdrop Number • Size
|For the Stage|