- Home /
Question by
hotozi · May 01, 2013 at 04:02 AM ·
gameobjectbuttonarray
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?
Comment
Best Answer
Answer by LightSource · May 02, 2013 at 12:09 AM
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.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Array Help GameObject Length Inventory 1 Answer
HELP How to remove gameobject from Built-in Arrays 2 Answers
Array problem? help please! 1 Answer