In the last three tutorials, Nate Nelson Blender Game Engine Numbers One-Three, you made a Cube-guy, gave him some texture, made a ground, a background, and an enemy. This is my rendered enemy.
NOTE: To make him checkerboard, Make the first color red, then the second one white. Go to the textures panel and click 'Nodes.'
Now. In this tutorial you will learn how to make your enemy track you, and how to defeat him and make your game first-person.
2.Now, with your Enemy selected, go to the Logic Editor panel (F4). Click on Add, Add, and Add. Connect the three, of course. Then change the 'Always' in the Sensor panel to a 'Near.' Then click on 'Property,' then type in 'Cube.' Make the 'Distance' to twenty (20.00). In the Actuators panel, make the middle button on the Loc row zero, point zero-five (0.05.)
3.Go back to your Cube-guy, and add a cylinder. Use the Widges to rotate and move it until it's sticking out of the front of your Cube-guy.
This is my Cube-guy with his sword sticking out of the front of him. Scale down the cylinder and switch to the scaling Widges by clicking on the blue square next to the green circle and the red triangle which is next to the pointing-hand icon that activates the Widges. Select the sword. You can give it a color and texture, if you want. Or you can press F9 to go to the editing panel, then press 'Set Smooth.'
4.Now, with your sword selected, go to Logic Editor (F4) and click on 'Add Property.' Name the property 'Sword,' with a capital S.
5.Select your Enemy again, then add another thing under the Actuators panel. Click on the word 'Motion.' A menu should appear. Select 'Edit Object.' Under that, click on 'Add Object.' A menu should appear again. What's with all these menus? Select 'Track To,' then click on OB: and type in 'Cube.' Then attach your Controller to the second Actuator. Good. Now, add three more things: one Sensor, one Controller, and one Actuator. Connect them. In the Sensor, change the 'Always' to a 'Collision.' Click on 'Property,' and type in 'Sword.' Then, in the Actuator panel, change the 'Motion' to an 'Edit Object,' then under that, change the 'Add Object' to an 'End Object.'
Good! Now you can press P with your mouse over the 3D view. Make sure you can see the entire ground, so you know when you're going to fall off. Your Enemy should track your Cube-guy now. If you touch him with your sword, he will disappear. Press Escape to exit Game Mode.
6.Now we've still got some work to do. Select your sword, then go to the Logic Editor panel (and I don't need to tell you that to get there you press F4). Add a Sensor, a Controller, and an Actuator. Connect them. In the Sensor panel, change the 'Always' to a 'Keyboard.' Click on 'Key,' then press the spacebar. In the Actuator panel, change the third button in the Loc row to negative zero, point zero one (-0.01.) Now add another Sensor, Controller, and Actuator. Connect them. Change the 'Always' to a 'Keyboard.' Make the key Left Shift. Then, in the Actuator panel, make the last button of the Loc row positive zero, point zero-one (0.01). Then use the Y (green) Widge to make it so that the sword is completely inside your Cube-guy. Now, when you press P, you'll be able to move with the arrow keys, and display and retract your sword with Spacebar and Left Shift.
7.The Penultimate part of the tutorial is cloning your bad guy. Select him, then hit Shift-D. Move the clones around with the Widges. They'll all try to kill you, but you can vanquish them all!
8.The last step is to make the game either first or third person. If you're going to do first person, then select the camera, and move so it's right in front of the Cube-guy. Then Shift-select your Cube-guy and hit CTRL-P. Select 'Make Parent.' Good.
NOTE: I'm sorry. The sword should be next to the Cube-guy, instead of in him. And the camera should be a little farther forward than him. Sorry. And you should make the camera and sword both actors, dynamic.
9.If you want to make your game third-person, just do the same thing I told you to do, but put the camera kind of looking over his shoulder.
Well, this just about wraps up the fourth Nate Nelson BGE Tutorial. Have fun on your game, and I'll see you next time!