A New Template for Alice 2.0 and 2.2

Henry Qin Susan Rodger Duke University Department of Computer Science Summer 2008

-1. Overview

Alice 2.0 and 2.2 come with 6 templates, each of which are nice if one is satisfied with a single type of ground throughout the course of their animation or game. For many, this is perfectly acceptable. We have developed a template that allows switching between all six ground textures, as well as methods for darkening and restoring the world. Suppose you have separate scenes (situated in different parts of the Alice world), and you would like a fade-out to black between scenes. My template will allow you to easily create that fade-out, fade-in effect. In this article, I will describe for you how to setup this template so it becomes available when you select "New World" in Alice, as well as how to use the template to create scene changes.

0. Downloading this template for all your new Alice Worlds (for Windows Users)

If you're using an Apple computer, please follow these instructions for this step instead. Then, you can come back here for step 1.

Start by downloading the template world, SuperSS.a2w. Save it in a location that you can find (such as the Desktop, or My Documents). If your computer decided that it was a good idea to convert your download into a ZIP file, please click here for instructions to fix this. Next, close Alice if you have it running. Then, find your Alice folder, and open it. You should see something that looks like this: You want to open the folder named "Required."

Now, you want to open the folder named "templateWorlds," and copy the template file you just downloaded into this (templateWorlds) folder. When you are done, your templateWorlds folder should look like this:

We have added the new template called SuperSS to the template worlds. If you have followed all of the above steps correctly, you should be able to load Alice and see the new template, SuperSS, among the other six, under the "templates" tab. 1. Setting the Scenes

When you create a new world and use this template, you will be able to use all six grounds as well as an automatic fade-to-black. The rest of this document instructs you in how to do this. We will start with the simple case: How to get one scene to fade out (to black) and a second one to fade in. Start a new Alice world. Select SuperSS template and add two penguims. This will be a "scene 1."

Now, drop a dummy at the camera position. Move the camera to some other place in the world (such that you can no longer see the penguins), and drop a couple of chickens. This will be scene 2. Then, drop a dummy at this position too for good measure.

Click the green "Done" button and get ready to code.

2. Using the Scene Change Feature with No Ground Changes

Start by moving the camera back to the scene with the penguins (which we've called "scene 1"). Now, let's add some code to smoothly move to scene 2. We'd like to get a glimpse of scene 1 before shifting, so let's start by waiting five seconds:

Now, let's darken the world. Click on EasyOriginalAtmosphere in the Object Tree, and pick hit methods. We want to call the method darkenWorld, as indicated in the screenshot above. If prompted, choose a duration of 1 second.

This will cause the world to be darkened over the course of 1 second. You should notice this if you play your world now. Now, while the world is dark, we want to move the camera to the second scene, with a duration of 0 (instantaneously). Then, since ours is not a spaceWorld, we want to call the EasyOriginalAtmosphere method restoreNonSpaceWorld, again wtih a duration of 1 second. Your code should now look like this:

When you run your code now, you should presently see the scene change. That's all there is to a simple scene change, using my library. Don't close it yet though - we're going to build on this for the next part.

3. Adding Ground Changes

Fade-in, fade-out scene change is nice, but what if we'd like our chickens on grass and our penguins on ice? Let's begin by starting our penguins (Scene 1) in ice. Click on the ground in the object tree, and click "Properties." Now, drag the "skin texture“ property and drop before everything else in the method editor. When it prompts you, select "SnowTexture." Now change the duration of this change to 0. Your code should look like this: If you play your world now, you should notice that you're starting with penguins on a snowTexture. Moreover, the chickens will also be on the snowtexture, since the texture was never changed! That ground change must happen while the world is dark between the scenes. We can put this before or after the camera change, since the camera change happens instantaneously, as will the ground change. I've put it after, here:

Don't forget to set the duration to zero, or your audience will be waiting on you! For more readable code, put the camera change and the ground change into a Do-Together, since that's our intention anyways.

You can download my completed world. That's it! Now you can do scene changes with different types of grounds, using the SUPERGROUND! Step 0 for the Mac

Download the template world to a directory you can find again. If you can't find it, use the spotlight, and look for the file named SuperSS.a2w. It is also possible that you will need to get rid of the "zip" extension that Apple computers append. Now, you want to Control-Click on the Alice application file, and click on "Show Package Contents," as in the screenshot below.

Then, double-click and open the contents folder. Then, double-click the Required folder.

Now, find and open the templateWorlds folder. Finally, copy my SuperSS.a2w file into Template worlds. When you are done, your folder should look like this:

Note that the ICON for yours may not be the same as mine, but don't worry about it.

Now, return to the main documentation for step 1 and the rest.