|
Switches
and Cases
Skill
Level = Intermediate
2nd
Tutorial By Postal v1
I remember when a
multi-mode gun was something special.
Now there a dime a dozen. I
have noticed many people are going the way of making a variable called int(i.e.
var int mode) then using if and else if questions (i.e.
if (mode == 1) etc then else if (mode == 2)
and so forth) which is perfectly good, but Switch is so much better. Switch allows you to select one of a set of options, then use
that. Well I shall get to
the code so you can see how it works, instead my having my babble on
incoherently.
//
Var()
Enum EMode {M_1,M_2,M_3,M_4} Mode;
ok
this goes up in with the variables
var[use
() if you want to be able to select which mode it starts off in,
with default props]
Enum
E[mode series name, I use mode, but you can use what ever you
want
]
{
M_[a
mode name]
|