Using the templates

Top  Previous  Next

Last month we have started to play with the _A6_template_project, a template that can be used for action games, shooters and even RPGs. Once again, you will need A6.405 and the updated A6.40 templates if you want to follow this tutorial; make sure to read the previous template article if you don't know how to update them.

 

Let's add a player to our room! Copy the guard.mdl file (I kind of like this guy) inside your \experiment folder; otherwise, you won't be able to place it in the level. Right click Wed's top view and then choose Add -> Add Model.

 

aum58_template1

 

You will see the following window:

 

aum58_template2

 

Select our \experiment1 folder and then click guard.mdl; you will see its characteristics (format, number of vertices, triangles, etc) close to the top of the window. If you have many models in the same folder you will (hopefully) be able to pick the right one by examining the pictures that appear to the right side of the window.

 

Press "OK" to place the model in the level. Choose a proper position for the player; the template code includes gravity, but we shouldn't rely on that. Here's my player placement example.

 

aum58_template3

 

Let's add an action to our player! Click Wed's File -> Project manager to bring up the "Project Manager" window.

 

aum58_template4

 

Click the "Add" tab, and then select "Class: PLAYER".

 

aum58_template5

 

This will allow us to select one of the existing player-related scripts.

 

aum58_template6

 

You can see that we have got 5 options to choose from:

- Biped Player;

- Biped Player Heads-Up Display;

- Biped Player Weapon "HUD";

- Biped Player Weapons;

- Car Player.

 

"Biped Player (01)" is your friend; select it and then click the "Add Script -=>>" button.

 

aum58_template7

 

Close the "Project Manager" window, right click our guard model and then choose "Properties". You will see the "Object Properties" window:

 

aum58_template8

 

Click the folder icon at show the list of the actions that are available.

 

aum58_template9

 

Attach the "PlBiped01" to our guard model, and then press the "OK" button. Close the "Object Properties" window, save the level, build it and run it. You will see the following image.

 

aum58_template10

 

Press Alt + Enter to switch to full screen mode. If you are wondering what has happened with our player model, that makes two of us. Now where is that guy? Shouldn't we call the police, offer a reward or something? Wait! I know! Let's press the zero key once, freeing the camera, and then let's look downwards. Our little guy is right there on the floor and (believe it or not) it is actually moving when we are pressing "WSAD" and jumping when we are hitting the "space" key!

 

The poor player was missing a camera, so let's add one right away: bring the "Project Manager" window on once again, select Class: CAMERA and Script: 3rd Person Camera. Press the "Add Script" button, making sure that the "3rd Person Camera (01)" action is listed on the right side of the window.

 

aum58_template11

 

Run the level again and you will (fortunately) see the player from a 3rd person perspective. Move it using the "WSAD" and "space" keys and look around using the mouse.

 

If you are one of those hairy guys you might want to try something more extreme, like a first person camera. To do this, simply add a "First Person Camera" to the project, like in the picture below.

 

aum58_template12

 

Run the level again and you will find yourself immersed in a first person viewing experience. Anyway, if you get your hair cut or you get bored with the 1st person camera, you can toggle the first / third person cameras by pressing F7.

 

That's all for today, folks! Next month we will get to customize the player and camera actions, making them fit our own player model and particular camera needs.