Pen

Pen Blocks.

The Pen is a feature in Scratch that allows a Sprite to draw shapes and such 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

Uses

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
  • This page was last modified on 29 June 2014, at 03:27.