| ThingMaker Documentation Chapter 5) Adding Actions

| The Swap Action If you MouseClick on one of the airplanes while it is flying, you will see a cartoon-like explosion animation. Once the mouse is released from the explosion animation, however, the planes keep on flying. You'll want to change this build so that the animation explodes on MouseClick and the crash Thing takes its place. This Action also prevents the plane from continuing to fly!

You can use the Swap Action to fix this problem. The Swap Action lets you switch one Thing for another including its position, layer, and visibility. In this exercise, you will use the Swap Action to switch the Explosion Thing with the Crash Thing.

At no time in the production of this Scene were real people harmed in any way. These animations represent remote controlled airplanes.

1. Select the Blue airplane and open the Settings Sheet.
If the airplane Thing is not visible, use the Scroll Bars to move the Scene Window up and down. You are likely to find that you must search outside the Scene Frame for some of the airplanes.

2. Drag the Swap Action to the MouseClick state of the Thing.
When you make this change, the Location, Visibility, and the Layer are swapped. Leave these as they are. The Settings Sheet also lets you choose the two Things that are going to be swapped. You can choose any two Things on the Scene: it doesn't really matter which one is selected for "of this Thing" or for "with this one." Since both are set to the current Thing by default, we'll leave "of this Thing" as the current Thing and choose the graphic we want to swap "with this one."

3. Click on the pop-up arrow next to the image which reads "with this one."
A pop-up list appears showing all of the Things in the Scene.

4. Choose the Thing crash1.

5. Test the change.
When clicked, the Plane Thing should immediately switch to the Crash Thing.

6. This is partly what you want, but what happened to the crash animation? If you look to the right of the Scene, you should see that the two Things have switched positions: the plane is now flying where the crash1 Thing was previously located.

Waiting for the animation
The problem with the Swap Action is that it happens immediately, when what you want is to have the MouseClick animation play before it takes effect.

We can accomplish this by using the Wait for end of animation parameter in the Swap action.

1. Stop the Scene from playing and open the Settings palette, select the Swap Action for the Plane Thing.

2. Click the "Wait for end of animation" checkbox.
The Swap action will occur after the animation finishes playing.

3. Test the Thing.
It should now work as we want it to.

Wait for end of animation interacts with another parameter for the animation called Play to end of sequence. Information about this parameter can be found in the Detail page of the Animation Settings Sheet. These two parameters interact depending upon how long the animation is set to play. Playing length effects how your Thing will react when clicked. If you unclick the Play to end of sequence check box, you'll find the effect no longer works. The interaction of these two parameters is explained more fully in the Reference section under "Animation Settings Sheet."

Finishing up
To finish the Scene, you can add the Swap action to the other two Plane Things to have them work the same way as the first Plane Thing. Remember to use the scroll bars to look outside the Scene Frame for planes that are out of view in Edit mode but will fly through the Scene in Play mode.

Once you've mastered the Swap Action and all the nuances of layering, you are ready for the most interesting Action of all: the Collision Action.

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