In this tutorial I am going to show you how to make a character that you play as and an enemy. We will also use the weapon that I have added as a file to end the enemy. When this project is finished you should have a basic character who can 1. walk forward 2. walk backward 3. walk left 4. walk right and 5. shoot and end an enemy. Your enemy should also be able to follow you.
Step 1: Making the Character
This game is going to be an FPS, (first person shooter,) so the character will be simple. First you want to add a cube to your scene place it on the side of the ravine with out the tree. Then go to the physics tab and click on Physics Type and select character.
Step 2: Going Through the Motions Part 1
Now that we have our character we need to make him move. So change one of the windows to Logic editor. It doesn't matter which one. Now add five keyboard sensors and five motion actuators. Then change all of the motion actuators from 'Simple Motion' to 'Character Motion.' For all of the sensors (but the last) activate 'True level triggering pulse mode' aka the box to left with the three dots at the top. Then in the box named key add these keys in this order, W,S,A,D then press the Spacebar for the last box. Now you should have all of your keys. Then in the motion boxes you are going to change the motions along the x and y axis IN THIS ORDER.1.y=0.10 2. y=-0.10 3. x=-0.10 4. x=0.10 5. Select the JUMP button.
Step 3: Going Throught the Motions Part 2
Now we are going to make the character be able to look around. This is very simple. Now open your logic editor again. Add a mouse sensor and a mouse actuator. Change the mouse sensor from 'Left Button' to 'Movement' and click on the box to the left with the three dots at the top Then change the actuator from 'Visibility' to 'Look.'
Step 4: Looking 'round Town
Now we are going to add the first person camera and gun. Delete the camera that was in the scene and add another one. Press 'Alt R' to clear its rotations. Then rotate it along the x axis by 90 degrees. After you finish that scale it down and set it on the cubes face. Now set the cube as a parent to the camera. Now set the cube to wire frame mode by going to the object editor and selecting wire. To add the gun you want to append it as an object. Then scale it down and move it to the right of the camera. Select the cube and press 'H' to hide it. Now change your view to camera view and finish positioning the shotgun. Now make the camera a parent to the shotgun. Now add an empty axis and make it a child of the camera.
Step 5: The Ammunition
Now go to the second layer and add a cube. Scale it down and change its physics to Rigid body. Now give it a radius of 2. Open the logic tab and add a new game property. Type the word 'bullet' in. Also go to the object options and name the object 'bullet.' Change the layer back to layer 1 and select the empty axis. Now in the logic editor add a 'Mouse' sensor and an 'Edit object' actuator. On the sensor select the box with the dots on the top of it all the way to the left. And change the Edit object to Add object and select the object 'bullet.' Make sure the time is set to 1.
...Now if you start the game you will be able to look around and walk around. You can jump and shoot.
Step 6: The Enemy
Now we will make a zombie type enemy. But first things first we need to duplicate the ground. After duplicating it name it 'NavMesh' and in its physics tab change it into a Navmesh. Dont freak out. The whacky colors are invisible in the game. Now add another cube and place it next to the tree. Name it Enemy. Open the logic editor and add a collision sensor and an edit object actuator. Also add an Always sensor and a Steering actuator. For the collision sensor type the property 'bullet' in. Dont forget to press the box to the very left with the 3 dots at the top. This is the same property you made for the bullet. Change the edit object/add object to end object. Now select the box to the very left with the 3 dots at the top on the Always sensor and connect the sensor with the Steering actuator. On the Steering mesh select target object 'Cube' or whatever you named the character. And select the NavMesh 'Nevmesh.'
Step 7: Now Play the Game.
Now you have a basic game where you can shoot and end the zombie like enemy and the knowledge on how to make a basic game.