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

This advanced tutorial continues the instructions in Scramble to teach several advanced behaviors including the use of counters and formulas. Press the "m" key to fire your missiles. You are given 5. Each time you hit the UFO your score will increase by 5. Get 15 points and win the game. Use up all your missiles and loose.

Note: As of this writing, only Internet Explorer is capable of displaying the scores. Netscape will display the counters in the Status Bar. The operational aspect of the game will be equally valid in either browser.

Method

1. Load the Scramble IMS file. It is the starting point for this tutorial.
2. Create two text Objects. Set one to "Score:" and the Other to "Missiles". Position the "Score" below the UFO and the "Missiles" below the F14.
3. Create a third string and set it to "Score Count". From the 'Text Style Combo Box' at the top right of the text editor select " Counter" . This will replace the string with the Object's 'Value' when it is displayed in the Browser. Position it to the right of the "Score" text you already created. Change the name of the Object to "ScCnt".
4. Create a fourth string and set it to "Missile Count". Change its type to 'Counter' and rename it "MisCnt". Position it next to the "Score" text you created previously.
5. Select all four strings as a temporary Group then select 'Align down' to align them vertically.
6. Create two more strings as Plain Text Objects. Set One to "Greate Game" and rename it 'GreateGame' and set the other to "GameOver" and rename it to 'GameOver'. Position them between the Fighter and UFO


You should now have four strings aligned verticall that display "Missiles: Missile Count Score: Score Count" and two string that will display a message at the end off the game. If you preview the project the MisCnt and ScCnt strings should be displayed as "0". Now we need to create and change some behaviors to manage the display of these strings.


1. Select the "Missile' Object and select the Object Editor 'Options' tab. In the 'Intial Value' edit box change the number from "0" to "5" either by typing it in or by using the UpDown arrows.
2. Exit the Editor and Select the Behavior Dialog. Make sure the Missile behavior 'fireB' is selected. Select the 'Trigger Events' tab and check the 'AND all Triggers' box near the bottom left of the dialog box. When this box is checked, all selected triggers must be true for the trigger to take place. When not checked, any one selected trigger will cause the Behavior to become Active.
3. In the Dynamic Triggers section check the Greater Than ">" check box adjacent to the 'Current Value' edit box. To fire the missile now the user must press the "m" key AND it must have a value greater than 0.
4. Select the 'Formulas' tab and check the box next to 'Apply to this Object when Active'. We can now change this Objects value when it is triggered Active. This Objects initial value is '5'. We will subtract '1' each time the missile is fired.
5. From the Operation drop down box on the same line, change the string from "Replace" to "Subtract". In the Value box change the default value from "0" to "1".
6. To display the current value of this Object, we will send it to the "MisCnt" Object that has already been set up to display its value. Check the box for 'Send results to another Object'. Leave the Operation as 'Replace'. From the 'Object List' drop down box select the "MisCnt" Object. Select OK to exit the dialog.


If done correctly, you should now be able to preview the project. The Missile Count counter should start with "5" and decrease by 1 each time the missile is fire. When the count becomes 0 the missile should no longer fire.

Setting up the Score is done the same way. We will use the UFO to keep track of the hits incrementing its value by 5 foe each one. Since we are starting with "0" there is no need to change its initial value with the Object editor.


1. Select the UFO and enter the Behavior dialog. Make sure that "UFOHitB" is selected in the 'Current Event" window.
2. Select the 'Formulas' tab and check 'Apply to this Object when Active'.
3. Set the Operation to 'ADD' and the value to "5".
4. Check the 'Send Result to Another Object' check box and select the "ScCnt" Object.


The final thing we wish to do is display the End Game messages. This is done by setting the score and missile counters to trigger the appropriate message if the missile count falls below 0 or the score reaches 15. The Behavior for each message is the same.


1. Select the GreatGame Object and select the Behavior dialog. Confirm the new Behavior and change its name to "EndGameE".
2. Select the 'Actions' tab dialog and uncheck the 'Visible' check box under 'When Not Active'.
3. Exit the Behavior dialog and select the "GameOver" Object text.
4. Select the Object Editor dialog. Be sure the 'GameOver' Object is select. In the 'Behavior' drop down box select the 'EndGameE' behavior.
5. Exit the Object Editor and select the 'MissCount' text counter. Select the behavior dialog and confirm the new Behavior. Name it 'MissCntE'.
6. Select the 'Trigger Event' tab dialog and check the Less Than "<" check box in the 'Dynamic Trigger' section.
7. Select the 'Actions' tab and check the 'Trigger Active' check box in the 'When Triggered Active' section. Select the "GameOver" Object from the Object list box.
8. Exit the Behavior dialog and select the "ScCnt" score text counter. Reenter the Behavior dialog and confirm the new Behavior. Name it "ScCntE".
9. Select the 'Trigger Active' tab and check the equals "=" and greater than ">" check boxes. Set the value box to "15".
10. Select the 'Actions' tab box and check the 'Trigger Active' check box under 'When Triggered Active'. Select the "GreatGame" Object.


That should be it. You can transfer values between objects to stop the counters if you wish. You should also not assume that this is the only way to accomplish designing this game.


UFOG
explodeG
Use the "m" key to fire your missile.
Score:
Counter
Missiles:
Missile Count
Web Engine Tutorials