Thursday, August 12, 2010

Blender Game Engine Tutorial: Part Three

Hi! It's me again. Ready for another Nate Nelson Blender Game Engine Tutorial? No? Hm...All those in favor, raise their subsurfed cylinders on the Z Axis, all those opposed...

Just kidding. Last time we made a ground, sky, and lighting, not to mention tracking to constraint the cameras to our Cube. This time, we'll make our Cube move in Game Mode with the arrow keys, and start making an enemy we can fight. So, everyone, START YOUR GAME ENGINES!!!!

By The Way, that was what my rendered image looks like. Yours should look something like this, unless, of course, you used different colors or textures.
1.To start, we'll have to make our Cube an actor. To do this, go to the Logic Editor panel by pressing F4. Under the word 'Panels' is a pink strip of buttons. Select 'Actor,' then click on the word 'Static,' which should be to the far left of the pink strip. a menu should appear. Click on 'Dynamic.' This will make your Cube's will bend under the mighty power of...

2.Gravity. You can test this force by bringing your Cube about 6 Blender untis upwards on the Z Axis. Either use the blue Widge or press 'G,' then 'Z,' then '6.' Then press Numpad zero to go to camera view, then 'P' to start the game. Your Cube should fall onto the ground you made. Press Escape to exit Game Mode. Your cube is still in the air. Do put it back, use the blue Widge or press 'G,' '-Z,' then '6.' Make sure that you press the hyphen key (-) before the Z, or your Cube will go up, instead of down. When it goes down six Blender units, click the Left Mouse Button or hit Escape to exit Grab Mode.





3.Now we're ready to make your Cube move. Select him with the Right Mouse Button, then press F4 to go to the Logic Editors panel. You will see three bluish-greenish buttons that each say 'Cube.' Beside them are three buttons that each say 'Add.' Click all three of the Add buttons.

4.Under the first 'Cube' button is an option that says 'Always.' Click on it. A new menu will appear. Select 'Keyboard.' The menu should extend into a purple one that says 'Key,' 'Hold,' 'All Keys,' 'LogToggle,' and 'Target.' No, this does not mean the department store. Click on 'Key.' The button will be selected, and the words 'Press a Key' will appear. Hit the up arrow on your keyboard.

NOTE: When I say the up arrow on your keyboard, I do NOT mean on your NumPad. I mean the four buttons with arrows on them next to the NumPad.

5.Now Track to Constraint your eyeballs over to the third and last panel. BTW, these three are called the Sensor, the Controller, and the Actuator panels. Notice that under 'Simple Motion' there are six rows of buttons, the top one being 'Loc.' This stands for 'Location.' See that all three of the options are at 0.00. Use the left-facing arrow on the middle button to move the number down to negetive zero, point ten (-0.10).

6.Now, if you press 'P' to go to Game Mode...nothing will happen. That's because you have to physically connect the Sensor, Controller, and Actuator panels. Notice that there's a gold sphere on the right side of the Sensor and Controller panels. Click and hold on the sphere to the right of the Sensor panel, and drag the mouse to the gold circle to the left of the Controller panel. When your mouse is hovering over the circle, let the Left Mouse Button go. Repeat that process to connect the Controller panel to the Actuator panel.

7. Good job! Now, if you press 'P' to go to Game Mode, and press the up arrow, your guy will move forward. Now we're going to do the same thing all over again. Press Add, Add, and Add. if you want to make this big so it's easier to see everything, put your mouse over the S, C, and A panels, hold down CTRL, and press the down arrow key. This will maximize the window. So now that you have added three more, uh, things, connect them like before, and change the 'Always' to a 'Keyboard.' Click on 'Key' and press the right arrow. Go over to your new Actuators panel and, on the 'Rot' (which stands for Rotate) row, make the last number negetive zero, point ten

(-0.10). This makes the guy rotate to the right.

8.Now add three more things (sorry I don't know the actual word for them). Repeat what you've done before. The Keyboard, pressing the Key button then the left arrow key, then attaching them. This time do the same thing in the Actuator panel, but make the Rotation positive zero, point ten (0.10), not negetive zero, point ten.

9.Good. Now all we have to do is add another three things. Attach them. Set the Key to 'down arrow key.' Then, on the 'Loc' row, make the middle one zero, point ten (0.10). After you've done that, press CTRL-down arrow to minimize the panels menu. Then press 'P' to start your game. Move your guy around with the arrow keys. Congradulations! You have made your Cube-guy move!


10.Press Escape to exit Game Mode. Now, with your mouse over the 3D view, switch to top view with NumPad 7. Scroll out until you can see all around the ground. then select the ground with the Right Mouse Button. Hit Shift, then the 'D' key. Hit Escape to exit grab mode. Then use the green Widge to move it forward. Repeat this process using the Y and X (green and red) until you have eight duplictes on every side of the original. this way, you won't fall off the edge so easily.

11.Add another cube with Shift-A. If you remember how to make a new color, do so. Red or black is ideal, because this is going to be the enemy. But, do whatever you want. It's your game. You can give him a texture, too.

12.Now, select your Cube-guy with the Right Mouse Button. Go to the Logic Editor panel (F4) and press 'Add Property.' Name the property 'Cube.' Make sure you use a capital 'C.'

13.Select your bad-guy. Go to the Logic Editors (F4) and click Dynamic>>Actor. Good. Now both your guys are actors, ready to act in your game. Have fun, and I'll see you next time!

No comments:

Post a Comment