The Health Kit


We'll start out with an easy one. Like I said, this will be a basic review, but it's important to go over the process involved in creating an item for use in the game so that the broad steps become obvious and second nature.

The Model

The Health Kit is little more than a fancy-looking box, as you can see from Figure 16.1. So this won't take long.

click to expand
Figure 16.1: The Health Kit in game.

  1. Fire up MilkShape and create an empty document.

  2. Use the Box tool to create a box, as shown in Figure 16.2.

    click to expand
    Figure 16.2: The box.

  3. Align the box to be centered at the origin for all three axes, as you can see in Figure 16.2.

  4. On the Materials tab, create a new material, using C:\3DGPAi1\RESOURCES\CH16 \ healthkit.png as the bitmap.

  5. Name the material "healthkit".

  6. Select the box and assign the healthkit material to it.

  7. Make sure that the 3D view has been set to texture mode. You should see a nice, shiny new first-aid kit kind of item there, like that in Figure 16.3. This one always has bandages in it!

    click to expand
    Figure 16.3: The Health Kit model.

  8. Save your work.

  9. After saving your work, choose File, Export, Torque Game Engine DTS. You will see the Torque Game Engine (DTS) Exporter appear.

  10. You want to take the defaults but have Collision Mesh set to None.

  11. Export the box to C:\3DGPAi1\ fps\data\shapes\items\healthkits.dts. Click Yes if you get an alert asking if you want to replace an existing file with that name.

Testing the Health Kit

To use the Health Kit in game, you merely have to run over it to pick it up. Then you activate it by pressing the "h" key to restore your health whenever it gets too low. You may remember using a kind of first-aid kit in one of your sample games from an earlier chapter—Emaga5—where you got health back just by running over the first-aid kit, or Health Kit. This one you have to pick up and activate; we'll test that functionality later when we get back into server scripts. Right now we just want to see our fine creation in the game world.

  1. Browse to C:\3DGPAi1 and click the Run fps Demo shortcut.

  2. Click Start Mission.

  3. In the Launch dialog box, make sure that the Multiplayer Mission box is cleared.

  4. Select Water World from the mission list.

  5. Click Launch.

  6. After the game loads, look around for a big gray block jutting out from the side of a hill into the water. Figure 16.4 shows what the block (marked by the arrow) looks like.

    click to expand
    Figure 16.4: Locating the big gray block.

  7. Run over to the block. On top of it you will find the Health Kit. You can stand there and admire it for a while if you like.

  8. Run over the kit to automatically pick it up. You will see a message in your chat window telling you that you've picked it up.




3D Game Programming All in One
3D Game Programming All in One (Course Technology PTR Game Development Series)
ISBN: 159200136X
EAN: 2147483647
Year: 2006
Pages: 197

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net