This web page has been designed to work with a browser that supports Dynamic HTML or Cascading Style Sheets
Geo23
Geo25
missileG
Lock & Load

This advanced tutorial explains how to set up an interactive Behavior that will fire a missile from an F14. In the above example you can move your F14 vertically with the mouse. You fire your missile by pressing the 'm' keyboard letter. When the missile reaches the end of its path, it will reload onto the F14 ready to be fired again.

Method


1. Setting up the F14 is straight forward. With the Sprite button, load the F14 GIF file from the Clip Art directory and position it appropriately in the window. Give it a name in the Object Editor 'F14'.
2. With the F14 selected, select the Action button. Say yes when asked to create a new Action. Change the name of the action in the edit box from 'Act1' to 'F14Act'.
3. Press the 'Select Path' and in the Interactive section select the vertical Mouse.
4. Exit the Action dialog with the 'OK' button and press the preview button '>>' to test the action in your browser. You should be able to move the F14 vertically with your mouse. Exit your browser to return to the IMS Web Engine window.


It is always a good idea to periodically save your work.

Loading and firing the missile is more complex in that it involves the use of the Metamorph operation to change its Action and Behavior. Once you understand the concept, it becomes a lot easier.

The missile has two Behaviors and Actions. The first Behavior loads the missile onto the F14. The second Behavior fires it. The Actions are complementary to the Behaviors. The first is the missile attached to the F14 and the second is the missile following a horizontal fire path. The Metamorph operation is used to switch between the two Actions and Behaviors.


1. Load the missile sprite and give it a name 'missile'
2. With the missile selected press the Action button and say yes to 'Create a new Action'. In the Action name edit box change the name of the Action from 'Act2' to 'LoadAct'. Press the 'Select Path' tab and from the 'Object Path' drop down box select the F14. It should appear in the window. By default this will cause the missile to trace the outline box of the F14. To attach to its origin press the 'Trace Origin' radio button.
3. Press the 'Selection' tab to return to the first dialog and press the 'Create new Action' button. Confirm saving the 'LoadAct' action
4. Name this new action 'FireAct'
5. From the 'Select Path' tab page under 'Linear Paths' press the right pointing arrow. This will create a linear path to the right. Make sure the 'Start' box is checked. This will define the path to start at the objects (missile) current position.
6. We could leave the action at this. To increase the speed of the missile, go to the 'Rate and Counter' tab page and increase the rate from 10 to 30. (once selected, a slider can be moved with the arrow keys). Be sure the path counter is left at 1.


Test your presentation with the preview button. The missile should be attached to the F14 but will not fire. We now need to create two Behaviors to load and fire the missile.


1. With the missile selected, press the 'Behavior' button and confirm the new Behavior. Change the name from 'Evt1' to 'FireEvt'.
2. Press the 'Trigger Event' tab and enter the letter 'm' into the 'Keyboard Select' box. Do not enter anything into the 'End Event' tab page. We want this action to be reset as soon as it has been triggered.
3. From the 'Actions' tab page check the 'Reset Path' and 'Reset Triggers' check boxes under 'When Triggered Active' . This is important. This Event will never become Inactive since we will use the Metamorph operation to switch to a different Behavior.
4. Press the 'Selection' tab and press 'Create new Behavior'. Confirm saving this Behavior.
5. Rename this new behavior from 'Evt2' to 'LoadEvt'
6. We want the missile to trigger this Event when it reaches the end of its fire path. From the 'Trigger Event' tab page check the 'At Path End' check box under the Dynamic Triggers section.
7. From the 'Actions' tab page check the 'Reset Path' and 'Reset Triggers' check boxes under 'When Triggered Active' . As above, this Behavior will never become Inactive.


The last thing to do is to setup the Metamorph operation to switch between the two Behaviors and Actions.


1. With the 'LoadEvt' Behavior still selected, press the 'Metamorph' tab page. A Metamorph operation can be used to change the Behavior, Action and Geometry of any number of Objects. In this instance, we want to change the Missile which will be the Object that this Behavior is attached to.
2. Check the 'Change this Object' box.
3. Check the 'Change Action' box. Since this Behavior will be triggered when the missile reaches the end of its fire path, we want it to reload the missile onto the F14. Select the 'LoadAct' action from the adjacent drop down box.
4. Check the 'Change Event' box. From the adjacent drop down box select the 'FireEvt' Behavior since once the missile is loaded the next event Behavior is to fire it.
5. Return to the 'Selection' tab dialog and select the 'LoadAct' behavior. Confirm saving the 'FireAct' behavior.
6. Select the Metamorph tab and check the 'Change this Object' box.
7. Check both the 'Change Action' and 'Change Event' boxes.
8. From the 'Change Action' drop down box select 'FireAct' and from the 'Change Event' drop down box select 'LoadEvt'.
9. Select OK to exit the dialog.


That should be it. Confirm that the presentation is working with the preview button and Save and Export. If something is not working a possible cause is that a necessary check box was not checked.

For your information, this tutorial took approximately two hours to write while the Presentation took under one minute by a knowledgeable user.


Web Engine Tutorials