Category Archives: Scratch How-to

Self Host Scratch Projects

I originally posted this on my blog at badgerfiles.com blog, but it really deserves to be here.

When I was in Columbus, a couple people asked me how to host Scratch projects on your own web server. Scratch makes it easy to share projects on the web, but for one reason or another, some people may want to host projects on a server they control.

Here is how you can host your own projects.

  1. Download these two files from the Scratch web site and save them to your computer:
  2. Create a directory on the web server. For example, scratch.
  3. Upload the ScratchApplet.jar and soundbank.gm files to the directory you
    just created on the web server.
  4. Upload you Scratch project to the scratch directory you created on the web server.
  5. Now, we need to build an HTML page to display the project. Save the following code as scratch.html:<html>
    <title>Scratch Project</title>
    <body> <applet id=”ProjectApplet” style=”display:block” code=”ScratchApplet” codebase=”./” archive=”ScratchApplet.jar” height=”387″ width=”482″>
    <param name=”project” value=”project- name.sb“> </param></applet> </body> </html>
  6. In the scratch.html code, find the value attribute and change
    project-name.sb to the filename and path, if necessary, of the project you uploaded to the web server.

Open a web browser and view the URL of the page you created, http://www.example.com/scratch/scratch.html.

That’s all there is to it.

Configure Sprite Startup Conditions

One of the cool things about Scratch is that it remembers state.  If your sprite is in the center of the stage when the animation stops, the sprite will be in the center of the stage when the animation starts again. The same applies for costumes, direction, graphical effects, etc.

But what if you want to your sprite to reset everything when the project starts?

If you want to a sprite to do something specific at the start of the project, you need to program the startup conditions. Here are a few blocks to help you undo the actions of your scripts so that your sprites may start from defaults.

go to – specify an x and y coordinate. Found in the motion palette.

switch to costume – specify a costume. found in the Looks palette.

clear graphic effects – Undo any graphical transformations such as color, pixelate, whirl, mosaic, brightness, ghost, and fisheye. Found in the Look palette.

hide – The sprite is hidden from the stage. Found in the hide palette.

show – The sprite is displayed on the stage. This is a default value, so it’s only useful if the sprite ends up hidden. Found in the Looks palette.

clear – Undo the drawings from the pen tool. Found in the Pen palette.

These just a few useful blocks because they clear the stage of some of that animation clutter we may create with our projects. The point, of course, is if you want your sprite to start under specific conditions, program it.

Install Scratch on Ubuntu

The Scratch Team have setup a repository on launchpad with the latest version for Ubuntu. Here are some quick instructions for Ubuntu Karmic Koala (9.10) and Jaunty (9.04).

  1. Open Synaptic Package Manager from the System > Administration.
  2. From the Package menu, select Software Sources.
  3. From the Software Sources dialog box, click on the Other Software tab and click Add…
  4. If you’re a Karmic Koala user, add the following repository when prompted:
     deb http://ppa.launchpad.net/scratch/ppa/ubuntu karmic main

    Click Add… again to enter the source repository:

    deb-src http://ppa.launchpad.net/scratch/ppa/ubuntu karmic main
  5. If you use Jaunty (9.04) substitute these sources:
    deb http://ppa.launchpad.net/scratch/ppa/ubuntu jaunty main
    deb-src http://ppa.launchpad.net/scratch/ppa/ubuntu jaunty main

    Software Sources List
    Software Sources List
  6. Click the Close button to close the software sources. You may be prompted that your repositories changes. Acknowledge the message.
  7. Reload your package information by clicking the Reload button in Synaptic Package Manager.

You can now search for “scratch” in Synaptic Package Manager and install Scratch as any other Ubuntu app. And now when the Scratch team updates the package, you can update with Ubuntu’s package management system.