Stamp
2.0 Stamp.png
Category Pen
Type Stack

The Stamp block is a Pen block and a Stack block. When used in a script, the Sprite will produce a bitmap image of itself, which is stamped onto the Stage. The image cannot be programmed, as it is not considered a sprite. Like other pen blocks, the stamp block will not stamp over other sprites.

New in Scratch 2.0, if a sprite has a ghost (transparency) effect, the stamp will keep the effect and stamp transparently onto the stage. All stamps from all sprites are removed with the clear block, but will remain even when the project is stopped.


History

Before Scratch 2.0, if an image was stamped, its transparency (the ghost effect) was not applied. This means that the ghost effect of the stamped object will always be 0. In the 2.0 prealpha from Scratch Day 2011, there was a Stamp Transparent block to get around this. It was not included in the full release of Scratch 2.0, as this bug was fixed with the normal stamp block. Stamping graphic effects works properly for all other effects, too.

Stamp (Function)

A stamp is created when a sprite uses the Stamp block. The stamp is a graphical duplicate that is penned in the exact position of the sprite. A stamp cannot move and cannot hold scripts — it is merely a copy of the sprite that is drawn by the pen, and therefore can be drawn over or cleared by using the Clear block. Stamps are always drawn above the Stage and below all Sprites.

Example Uses

This block is commonly used and is vital to many projects:

  • Having multiple images of a sprite on the screen
when gf clicked
change y by (10)
stamp
change x by (20)
stamp
  • Covering up part of the stage
  • Creating an effect
  • Creating the illusion of multiple sprite movement in One Sprite One Script Projects
  • Rendering a random world
  • In some types of drawing projects

Project Types

Example Script

when gf clicked
go to x: (56) y: (43)
stamp
go to x: (4) y: (123)
stamp
go to x: (132) y: (6)
stamp

Workaround

One simple workaround is to create a clone of a sprite that does nothing:

create clone of [myself v]

However, the clones could still eat up memory and should not be relied on. There is also a clone limit of 300 whilst stamping is infinite.

That said, clones will appear in front of other sprites and clones whilst 'stamps' will appear behind all layers excluding the backdrop, making this workaround reliable if you don't want to "stamp" on the backdrop. An extended workaround is:

set [stamping? v] to [1]
create clone of [myself v]
set [stamping? v] to [0]

when I start as a clone
if <(number of stamps :: variables) > [301]> then
delete this clone
end

Examples

See Also