Blender 3D: Noob to Pro/Advanced Tutorials/Advanced Game Engine/Game Creating Techniques(GUI)/Creating Moving Menus

< Blender 3D: Noob to Pro‎ | Advanced Tutorials‎ | Advanced Game Engine‎ | Game Creating Techniques(GUI)

In this section, you are going to learn a variety of ways to make menus with motions. These menus can be used in more ways than the simple pop-Up menus, such as in-game if you need to select something you can use this to bring up a menu smoothly. In this section there is heavy use of Properties, "Property" Logic Blocks, and especially IPO usage. When you do it once, it will be very much easier to do it again.

Making Moving SelectorsEdit

To kick this tutorial off, let's just do a simple icon that will be next to the selected menu item. There will be 6 possible menu items, which can be controlled with both the arrow keys and the mouse. Let's begin by booting up Blender, and deleting everything--then adding a camera.

Set this camera to orthographic. Now I like making things look nice, but here are the basics of what you will need for this tutorial:

  • Make 6 Planes, all different objects, and put them in a vertical list.
  • Make a circle next to the first plane. This will act as the Selector.

So after you've made you objects, it should look similar to this:

For me, I made mine look more like this, a little more detailed:

So now that we have our menu set up, it's time to set up the properties that will tell the selector how to move. Select the selector that will be moving and give it a property name "Selection". Make it "Int" type, and start it out at "1". To get this selector to move the way we want it, we have to set up its movements. Make sure you are on frame 1, and put the cursor on the first menu item, then Insert Keyframe for "Loc". Next, move to frame 2, and put the cursor on the second menu item, then insert "Loc" Keyframe, and continue in this fashion for all your menu items. To get this applied in the Game Engine, in the logic bricks, add an "Always" Sensor (True Pulse Enabled), connected to an "AND" connector, and connected to a "IPO" Actuator, set to "Property" with Prop:Selection. Now we can do 3 things with this selector to have it move like a selector in a video game:

Up/Down Arrow Keys
To make the up and down arrow keys work properly, Select the Selector and add four sensors, controllers, and actuators. Make two sensors keyboard, with one set to "Uparrow" and one set to "Downarrow" (do not activate pulse triggering). Make the other two sensors Property Sensors, with True Pulse. For the first, make it "Equal", Prop:Selection, Value:0. For the other, make it "Equal", Prop:Selection, Value:7. For the Actuators, make all four "Property" sensors. For two of them, make them "Add", Prop:Selection, and make the first "Value:-1" and the second "Value:1". The other two should be "Assign", Prop:Selection, with the first at "Value:1" and the next as "Value:6". Now connect them as follows:
Click To Enlarge Image


Now you can play your game, and the arrow keys should work just fine!

If you don't know what a HotKey, it's a way to access menu items or action by pressing a specified letter, instead of just clicking or arrow keys. This method will require a different step when you make your UV text textures, as you will need to somehow change one letter (either the color or possibly underline) to let people know that that is a HotKey action.

The HotKey system is easy to set up right alongside the IPO/Selection property. In each menu item, highlight or make special one unique letter in each menu item. Then, with the selector selected, set up 6 keyboard logic sensors, each one for a different letter. Add 6 controllers, and 6 actuators as well. Make all the actuators "Property", "Assign, Prop:Selection, starting with Value:1 progressing to Value:6"

Mouse Selection
Our final selection method we can add is the mouse scroll over. Set up the Mouse Sensor to Scroll Over for all 6 invisible selection planes. Then, make the AND Controllers and connect to your original set of "Set Property" Actuators. that matches the Object's IPO property number. It's fairly simple.

Make the Selection
The final thing to do is, once the selections are set up, make another 8 sensors, 7 controllers, 6 and actuators. Now make the 7th one a keyboard sensor for the ENTER key, as most people usually think they can start a game by pressing ENTER. The 8th Sensor is for another Mouse Sensor for "Left Click" so that if any of them is highlighted and you Left-Click the mouse, then it will be equivalent to pressing the ENTER key. That may be confusing as, unless you set up the dozen extra sensors, controllers, and actuators, you don't need to scroll over the selection to pick it, so that 8th sensor is your choice whether you want to add it. Connect the 7th and 8th sensor to the 7th controller. If you have the 8th sensor, make it an OR controller; otherwise, make the controller AND. As for the first 6 sensors, they should be Property Sensors for "Prop:Selection" "Value:[1-6]". Connect each to their own separate controller. Now connect the 7th controller to all 6 Actuators, and the first 6 controllers connect to their own Actuator alongside the 7th. The Actuators can be whatever you want them to: whatever the selection causes to happen when you select the item selection.

Make the Menu MoveEdit

So we created a selection-based moving icon on a menu, but what might happen if you select that item and need a sub-menu in-game? You can't very well pause the game every time (unless it's a pause menu). This is where making the menu itself move comes in very handy. In this section, you will make an object clickable, and once clicked it will give out a submenu, which in itself will be able to give out a submenu.