Custom stamping game scores with costume numbers

Stamp and Clear

After you get the logic in place to select the right costume, the stamp block will create an image of the costume on the stage. The hide block in the script is important because as the script runs and evaluates the numbers in the Score variable, the sprite (and its costumes) are changing position on the stage. After the image stamps on screen, the sprite moves 66 pixels to the right.

If you do not hide the sprite, then you will always end up with one too many numbers visible on the stage and the last number will repeat because you will have the stamped images and the actual sprite.

Feel free to test this out. Try replacing the hide block with a show block and see what happens.

The stamp block is a great way to create a pattern that is either clear (as in a number) or random in nature. You could perform some graphical effect on the costume before stamping its image. The limitation in Scratch 1.4 is that you cannot interact with the stamped images, which means that after the script stamps, that image is in place until the clear block runs.

The clear block will remove all the pen effects, including all the stamps, at one time.

Positioning the Stamped Images

My sample script is starting in the center of the stage, but if you're displaying the score during the game, that won't be a good location. The size may also be off. A bit of trial and error will get the stamps positioned and sized appropriately.

I will leave you with a challenge. If you wanted to center the number on the stage based on how long the number is in Score, how would you script that?

Happy Scratchin'.

The Author

Michael Badger wrote the Scratch 1.4 and 2.0 Beginner's Guide series from Packt Publishing. Learn more at

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content