Pen Blocks.

The Pen is a feature in Scratch that allows a Sprite to draw shapes, plot colored pixels, and so forth on the screen with the Pen Blocks.

Lines, dots, rectangles, and circles are the easiest shapes to draw, but with enough scripting, any shape can be created.

Blocks Related to the Pen

Main article: Pen Blocks
  • Clear — Clears all pen marks on the screen
  • Pen Down — Turns the pen feature on inside a sprite; the sprite will pen on the screen wherever it moves until the pen is turned off
  • Pen Up — Turns the pen feature off, stopping a sprite from penning
  • Set Pen Color to [] — Sets the color of the pen to a color chosen by the programmer
  • Change Pen Color by () — Changes the pen color by a certain value
  • Set Pen Color to () — Sets the color of the pen to a color chosen by the programmer using a number system
  • Change Pen Shade by () — Changes the shade of the color by a chosen value
  • Set Pen Shade to () — Sets the shade of the color to a chosen value
  • Change Pen Size by () — Changes the size of the pen by a chosen number
  • Set Pen Size to () — Sets the size of the pen to a chosen number
  • Stamp — Draws a copy of the Sprite on the Stage

Flash Player Glitches

The Flash Player appears to set a maximum pen size. This is due to the Flash Player using one byte of data to store the pen size. There are 256 possible outcomes of one byte (28 values encoded in 8 binary bits), so the Flash Player most likely uses the 256 possible outcomes to each stand for a pen size from 0-255.

The Flash Player also has a bug where the pen size "1" does not paint the entire pixel. If the pen size is set to 1 and used in Scratch to paint every pixel, a solid region will be formed. However, with the Flash Player, a translucent region will be formed as only part of each pixel will be colored. To avoid this, set the pen size to "2" if you want it to be one pixel on the Flash Player.

However, this glitch can be helpful if one wants to draw transparent regions on the flash player. It would take a long time to draw the transparent figure pixel by pixel even with turbo speed, so a sprite using the ghost Graphic Effect would be more effective.

Also, when Flash Player is drawing with the pen using medium or low quality, very low pen sizes are not drawn at all. To change your quality in the flash player:

  1. Right-click (for P.C.) or Ctrl-click (for Mac) the project
  2. Click on Quality
  3. Choose desired quality


The pen blocks are often used to:

  • Make Snake style games
  • Make a trail behind a sprite
  • Animating
  • Drawing objects in one sprite, one script projects
  • Drawing patterns
  • Creating graphs
  • Program graphics editors
  • 3D projects

Transparent Pen

Transparent pen is a feature in Scratch 2.0 added in v435.2[1] that allows the transparency of the pen.


The formula for ARGB (aka RGBA) is similar to that of RGB (red, green, and blue), but it has an additional value, Alpha (A) for opacity. Alpha is identified by a number 1-255, where 1 is completely transparent and 255 is opaque. The formula for RGB (without Alpha) is:

set pen color to ((((R) * (65536)) + ((G) * (255))) + (B)) // Be sure to use the pen color block with the color input (like the one below), or the colors will not function properly.

set pen color to [#0000FF]

And the formula for ARGB is:

set pen color to ((((A) * (16777216)) + ((R) * (65536))) + (((G) * (255)) + (B)))

Warning Warning: Make sure the A, R, G, and B values are whole numbers (rounded) so they don't contribute to other colors' values. To ensure that this does not happen, it is recommended that you use the following code:

set pen color to ((((round (A)) * (16777216)) + ((round (R)) * (65536))) + (((round(G)) * (255)) + (round (B))))


  • This page was last modified on 30 May 2015, at 20:06.