Hi,
I have one horse animation in the library.
I have made 6 instances of the Horse() that’s in the library named:
horse0_mc
horse1_mc
…
…
horse5_mc
I have a function called checkBound() that checks whether the horse has crossed a particular line (x value)
The code is:
function checkBound()
{
if (horse0_mc.x <= -800) {
Hwin(0);
} else if (horse1_mc.x <= -800) {
Hwin(1);
} else if (horse2_mc.x <= -800) {
Hwin(2);
} else if (horse3_mc.x <= -800) {
Hwin(3);
} else if (horse4_mc.x <= -800) {
Hwin(4);
} else if (horse5_mc.x <= -800) {
Hwin(5);
}
}
Instead of typing the whole instances of the horse
can I do it with one if and else with the changing values as variables?
Problem: If so how is horseX_mc where X = 0, 1, …5 be written ?
I suppose we could easily pass the corresponding variable X to the function Hwin(X).
Hope the question is clear.
Thank You.