Scrolling effect for GUI menu in BGE

So I'm making a GUI for my first person shooter type of game and I'm having trouble with making the effect for scrolling through the icons, trying to select one at a time instead of all. I basically have no idea how to do it so my question is, does anyone know how to use the mouse to scroll through the icons instead of selecting them all? I know why it selects them all I just want to know how to select them one at a time using the mouse wheel to go up and down the icons.

Here's a link to what I'm trying to make overall (https://www.youtube.com/watch?v=ALGcJVFb5oo) but as or right now I just need help getting the icon selection part right.

You can check out the blend file here- https://www.dropbox.com/s/p0312glj761zaei/SAO%20Ui.blend?dl=0

The only controls I have so far is when you press E it brings down the menu and when you use the wheel on the mouse it selects the icon (which is what I'm having trouble with...)

• you are activating them all at the same time – Chebhou Apr 27 '15 at 22:24
• I realize that its just the problem is how do i select them one at a time – CloudyCastle71 Apr 27 '15 at 22:28
• one send message to the next to get active , or you'll have to do some scripting – Chebhou Apr 27 '15 at 22:29
• any suggestions on how to start either of those – CloudyCastle71 Apr 27 '15 at 22:32
• OK incrementing a property would be better , I'll try... – Chebhou Apr 27 '15 at 22:34

You can use a property to hold the selected circle index, then switch between them each time the mouse-wheel rotate.

the easiest way was the script, the script is attached to the first circle as follows :

the first circle has two properties selected "the index of the selected circle" and open "indicates whether the menu is open or not"

here is the script used in the file :

def switch_selected():
#get this controller
cont = bge.logic.getCurrentController()
# the object running the script "1st cicle selected"
owner = cont.owner
# get this scene and a list of its objects
scene = bge.logic.getCurrentScene()
objects = scene.objects

#hide all circles  to clear the previous selection ( also in case the menu is closed no circle is selected)
objects['1st cicle selected'].visible = False
objects['2nd Circle Selected'].visible = False
objects['3d cicle Selected'].visible = False
objects['4th Circle Selected'].visible = False
objects['5th cicle Selected'].visible = False

if owner['open'] :
#get the mouse wheel sensors
mouse_up = cont.sensors["up"]
mouse_down = cont.sensors["down"]

#if mouse up increment index
if mouse_down.positive :
owner['selected'] += 1
if owner['selected'] > 4 :
owner['selected'] = 0
#if mouse down decrement index
if mouse_up.positive :
owner['selected'] -= 1
if owner['selected'] < 0 :
owner['selected'] = 4

# read the index and set the selected to be visible
selected = owner['selected']
if selected == 0 :
objects['1st cicle selected'].visible = True
elif selected == 1 :
objects['2nd Circle Selected'].visible = True
elif selected == 2 :
objects['3d cicle Selected'].visible = True
elif selected == 3 :
objects['4th Circle Selected'].visible = True
elif selected == 4 :
objects['5th cicle Selected'].visible = True

switch_selected() #a call for the above function at each tick


Here is the file

• Dude thank you soooo much!! I couldn't get this figured out for days!! Thanks you – CloudyCastle71 Apr 28 '15 at 0:18
• @CloudyCastle71 you are welcome, and if you see that this solve your problem mark the answer as accepted ( the check mark on the left ) – Chebhou Apr 28 '15 at 0:20