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.
1.First, go to top view with NumPad 7. Select your Enemy with the Right Mouse Button. Then hit NumPad Delete. Make sure you hit the one on the NumPad, otherwise you will have just killed your Enemy without raising a weapon.
NOTE: In all these tutorials, Number Lock (In the top, left-hand corner of the NumPad) MUST BE SELECTED! On most keyboards, a light will go on when Number Lock is on.
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!
Hi Nate! :D
ReplyDeleteAbout the profile picture, I made it with Blender and GIMP - it's my standard avatar pretty much everywhere, I call it "The Legend of Blender 2.5"...I plan on changing it eventually though, as the Master Sword is from Zelda and I'd like something a bit more original :)
Anyway, seems like a pretty cool blog! I'll follow those tutorials soon, they look interesting :D I don't know much about the BGE, so they'll probably help :D
Thanks! You know, you're my very first follower on any of my blogs who isn't related to me? Thanks for following. If I get my parent's permission, I'll follow your blog, too.
ReplyDeletelol, I had that too for a while :) you're welcome!
ReplyDeleteThanks, Natronl! Sorry I couldn't answer your question until today. On my computer (and it should be on most computers as well) there is a button that says 'PRTSC SYSRQ' which stands for Print Screen, System Requirements (I think). It should be on the same row of keys as the F1, F2, etc. buttons. It may say something different, though. After hitting that button, you can paste the image in a photo editing program and save it. I'm not positive that's what you meant; if not, sorry that I misunderstood. I'm also assuming when you said 'post on my blog' that I did that correctly too. If not, just delete this comment. Hope this helps!
ReplyDeleteThanks Ben. I actually was wondering what that button did.... That helps SO MUCH!!!! Now I can make better tutorials. Actually, I'll revise the old ones. Even better!
ReplyDelete