All posts by Michael Badger

Author.

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.