Array weapons Wheel scroll switch

i have a bag of bombs…that i put in a array length!! SO…supose im equiped with a smoke bomb and in my bag i havee 10 other bombs…i want to be able to switch to the next bomb by scrolling the wheel mouse or even press a button…but i dont know how to do it…do someone know or something?

1 Answer

1

function Update () {

if(Input.GetKeyDown("a")) {

//equip bomb 1

}


if(Input.GetKeyDown("b")) {

//equip bomb 2

}
}

or

var bombNumber : int = 1;

function Update () {

if(Input.GetKeyDown("a") && bombNumber == 1) {

//equip bomb 1

bombNumber ++;

}

if(Input.GetKeyDown("a") && bombNumber == 2) {

//equip bomb 2

bombNumber ++;

}
}

So on and so forth.

lol never think this way but yeah!!