Pen Blocks

Pen blocks is one of the ten categories of Scratch blocks. They are color-coded dark-green, and are used to control the pen aspect of the Scratch Program.

There are 11 Stack blocks in this category.

According to the Scratch Statistics, this is the least used category, with only over 2,000 uses.

Pen blocks are useful when creating a one sprite one script project, allowing one to take various actions:

  • Stamp the sprite
  • Put the pen down
  • Release the pen

One example of a one sprite one script project is a simple drawing program.

Pen Blocks can also used to make Games and Simulations, as well as other things.

Blocks

Warning Note: Click on a block to learn more about it!

Scratch 2.0 has the following 11 Pen Stack blocks:

The pre-alpha of Scratch 2.0 from Scratch Day @ MIT 2011 additionally had the following Pen Stack block:

Suggested Pen Blocks

<pen down?>
(pen color:: pen)
(pen shade:: pen)
(pen size:: pen)
switch to canvas: [canvas1 v] ::pen //allows switching to a particular canvas for editing

clear [canvas1 v] ::pen //clears selected canvas (also includes options all and current)

show canvas [canvas1 v] ::pen //would display selected canvas (also includes options all and current)

hide canvas [canvas1 v] ::pen //would stop displaying selected canvas (also includes options all and current)

bring [canvas1 v] to front ::pen //would shift the selected canvas to the front(also includes options current)

move [canvas1 v] to layer (1 v) ::pen //would reorder the canvases (also includes options current)

These are wanted by many Scratchers, as they would make programming much easier.[1] The first would return the Boolean value of true if the pen is down. The second would return the pen color value; the third, the pen shade value; the last, the pen size value. Some Scratch Modifications have at least one of these.[citation needed] Workarounds are possible by maintaining variables to that keep up with these values and updating them whenever the pen state/color/size/shade are changed, possibly by leaving a separate script running that alters the pen when the variables are changed, and only modify the variables in other scripts instead of changing the pen attributes directly. Pen canvases would be independent from each other allowing them to be modified without affecting the others.[1]

In Scratch 3.0

Clock.png This article or section contains information about a feature from a future version of Scratch that is unreleased and is subject to change. Please cite any info added in order to prevent speculation.

In Scratch 3.0 the Pen Blocks will be an extension[2]. set pen size to (1), set pen shade to (50), set pen color to (0) and a new block called "Set Pen Transparency to ()" will be one block. Older blocks will be hidden, but they'll be kept in order to use legacy codes.[3]

References

  1. https://scratcharchive.asun.co/forums/viewtopic.php?id=118
  2. https://github.com/LLK/scratch-vm/issues/734
  3. https://github.com/LLK/scratch-vm/issues/735
  • This page was last modified on 20 November 2017, at 08:09.