| ThingMaker Documentation Chapter 5) Adding Actions

| Adding Actions Actions are the heart of interactivity in ThingMaker. Though you've had some encounters with Actions in the earlier tutorials - and you should try those before exploring this Chapter - the next two tutorials explore the Actions available in ThingMaker.

- Tutorial 6: Covers Layers and the Swap Action.
- Tutorial 7: Explores the Collision Action and the Hide Action.

  Tutorial 6: Layers and the Swap Action
  This Tutorial introduces the Layer, Swap, and Hide Actions. You'll learn about the concept of visibility and the importance of naming Things properly to avoid confusion. An understanding of the concepts developed in this Tutorial is vital before moving onto the discussion of the Collision Action in Tutorial 7.

  Here are the steps you'll perform in this tutorial:

- Open an existing Scene and add a Drag Action to a Thing
- Change the Layer of a Thing
- Use the Layer Action to change layers while viewing the Scene
- Rename some Things
- Add a Switch Action to a Thing

  Getting Stared
  1. Run the ThingMaker application.
  If it isn't running already, launch ThingMaker and save your current Scene File.

  2. Open the file Tutorial 6.tms
  It's contained in:
  drive:\Program Files\Parable\ThingMaker\Tutorial\Tutorial6.tms

  3. Preview the Scene by clicking the Play Button.
  As the Scene plays, three airplanes fly over the countryside. When you MouseOver the helicopter, its rotors will start, MouseClick and the rotors will speed up.

  Add the Drag Action to the Helicopter Thing
  1. If the Scene is still playing, press the Edit button to stop the playback.

  2. Open the Settings Sheet, and click on the Helicopter Thing to select it.

  3. Put a Drag Action into the Helicopter's MouseClick Settings Sheet.

  Drag the Drag Action Icon from the Actions Toolbar to the MouseClick Tab of the Helicopter's Settings Sheet.

  4. Test the Scene.
  You should be able to drag the Helicopter Thing around the Scene. Note that the helicopter appears to be flying above the planes in the Scene.

  Layers in ThingMaker
  The Helicopter Thing is reasonably convincing as an animated object flying over the planes. When you release the mouse and the helicopter "lands," and the rotors stop - you'll notice that the planes still appear to fly under the helicopter. Why? The explanation is quite simple: the Helicopter Thing was placed in the Scene after the Plane Things. This is layering. You can change the look of a Scene by changing the layers. In this Scene, you can change the layer of the Helicopter Thing in the Scene to create a more realistic look.

  All Things are placed within a specific layer. When a new Thing is added to a Scene, it is placed in a layer above the Things that are already present. The last Thing added to a Scene will be placed on top of all previously placed Things.

  To change the order of Things in the Scene, use the layer commands in the Edit menu at the top of the Scene Window: Bring to Front, Send to back, Bring Forward 1 Level, Send Backward 1 Level.

  We are going to place the Helicopter Thing in the layer that is above the background but below the airplanes.

  1. Select the Helicopter Thing.

  2. Choose Send to Back from the Edit menu in the Menu Bar on top of the Scene Window.
  The Helicopter Thing disappears, but the selection rectangle remains visible.

  The Helicopter Thing is now on the bottom layer. It is behind everything else in the Scene including the background; the background Thing should actually be in the bottom layer and the Helicopter Thing should be above it. Because there are several Things in the Scene, the easiest way to properly arrange the layers is to send the Helicopter to the bottom layer (you just did this), and then place the Background image behind it again. Then, the Helicopter is where it belongs, one layer above the background.

  3. Select the Background Thing.
  Click to select it.

  4. Choose Send to Back from the Edit menu.
  The Background is sent to the bottom layer which is behind the Helicopter, making the Helicopter visible again.

  5. Test the Scene.
  Press the Play Button. Is the Helicopter Thing beneath the Plane Things, as it should be?

  The Layer Action
  Moving the Helicopter Thing below the airplanes makes the Scene more realistic when the helicopter isn't "flying," but it doesn't help much when the helicopter is flying. From a design standpoint, having the helicopter fly above the planes is more interesting and realistic looking than having the planes fly over the helicopter. The Layer action lets you change the layer of the Thing while the Scene is playing. By adding the Layer action to the MouseClick state of the Helicopter, we can have the helicopter fly over the Planes in MouseClick thus differentiating the action from State to State.

  1. Go back to Edit mode by Pressing the Scene Window Edit/Play Button.

  2. Add the Layer Action to the MouseClick state of the Helicopter Thing.
  The Settings Sheet for the Layer Action offers a number of parameters. You can choose which Thing you want to affect using this Action. As you might expect, the current Thing is set to the top-most layer by default. You can specify where you want the Thing positioned in terms of level. For this Settings Sheet, the default setting is "to front." It means the Thing will be moved to the top most layer.

  3. Play the Scene.
  The Helicopter Thing should remain below the Plane Things in Default and in MouseOver, but when you click and drag, it should jump in front of the other Things in the Scene. How has the addition of the Layer Action affected the Thing?

  Reset at End of Mouse Event
  So the Thing changes layers when clicked. That's fine, except now you've introduced a new problem: when you release the mouse, the Helicopter Thing remains on top of the other Things in the Scene. It doesn't look right, especially when what you really want the Thing to do is return to its previous state.

  There's a simple solution to this problem, and you can practice it now. Most Actions have a Reset at end of mouse event check box. This means that the Action is triggered when the State changes, but the Action is undone when the Thing reverts to a prior state. Set this check box to have a Thing's parameters return to their original values after a mouse event.

  1. Choose the Layer Action's Settings Sheet in the MouseClick State of the Helicopter.

  2. Click on the check box to Reset (to the original layer) at the end of mouse event.

  3. Replay the Scene.

  4. The Helicopter Thing should begin under the planes, then fly above the planes when it is dragged, and then it should fly below the planes when the cursor is released.

  Renaming Things
  By now, you've probably noticed that Things have names. These names are displayed in the Gallery window, as well as in the Settings Palette in the Title Bar. Actions like Layer and Swap let you select the Thing the Action will affect. Creating unique names for Things in a Scene lets you differentiate among Things that look similar but act differently and serve different purposes. You can rename Things in the Scene and in the Gallery by using the Information Tab in the Settings Palette.

  1. Find the three plane crash elements in the Scene.

  2. Select the blue crash.

  3. If it's not already open, open the Settings Palette.

  4. Click on the Information Tab of the Thing.
  The Information Tab is Tab labelled "i" on the top right hand side of the Settings Palette.

  This displays details about the Thing including the Thing's name.

  5. Change the name to crash1 in the Field under Thing Name.
  The name in the Title Bar of the Settings Palette is not updated immediately, although the Thing Name field is. If you select another Thing, and then reselect the crash Thing, you will see that the name has changed.

  6. Rename the Pink crash, crash2, and the yellow crash, crash3.

  <--Previous | table of contents | Next -->