Hello, i want to setup a simple weapon manager where selection is done by scrolling the mouse wheel.
What is the most efficient way to achieve this?
Let's say, If i have a variety of weapons as children of the weapon manager, should I them reference as an array to use in a for loop? how do i then name each array's element/indices & match to it's children's indices so i could later use both of them as one indices to change their values from the mouse wheel? Which in return will change the weapon..(Correct if I'm wrong but that's what I understood on get_children from the Node doc):
For example(script is attached to the manager):
var weapons = self.getchildren()
var weaponindex = 0
for weapon in weapons:
if weaponindex:
weapons = self.getchild_count()
am I in the direction? If so how do i continue on from this? thinking about it now, naming each slot will force me to get all the array's & children indices one by one, am I correct? Is there a better & simpler way to achieve this ? Thanks in advance for your helping!