Archive.png This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.

Creating a moving variable monitor (the display of the variable) can be done, but requires some knowledge of how to hack Scratch. However, it does not work online. A method that works online is possible, but is harder to program.

Morph Embedding Method

First, create a variable watcher. You can change it to a large or slider display if needed. Then create a sprite. This sprite can be bigger or smaller than the variable watcher. Drag the variable watcher on top of the sprite.

Moving-var-1.png

Shift-Click-R and turn fill-screen off. Then alt-click on the watcher until a pink text "Watcher" appears under it.

Moving-var-2.png

Click on the red icon above the watcher and in the menu select "embed...".

Moving-var-3.png

In the new menu, click on "ScratchSpriteMorph".

Moving-var-4.png

Turn fill-screen on, and then hide the sprite with the following script:

when gf clicked
set [ghost v] effect to (100)

Now by moving the sprite with the motion blocks, the variable watcher moves. This happens because the variable's watcher Morph has been embedded onto the sprite's Morph.

Watcher Sprite Method

This method uses a sprite as the variable watcher. It is only practical for a variable that has a small amount of possible values.

First, create the variable and show it. Set it to each value in turn, and take a screenshot. Import all the costumes into a sprite. Each one should be named the value it represents. Finally, use this script to show the correct costume:

when gf clicked
forever
 switch costume to (variable)
Cookies help us deliver our services. By using our services, you agree to our use of cookies.