Need help with AS3 script
Hey there,
iam making a shell game and found the following code on the web but want to remove one shell so that its 3 shells instead of 4. After removing the myBall = 4 on my own the game wont work right anymore, so sometimes the right shell is not the one it is supposed to be.
Can you help me to remove the myBall = 4 while still keep the logic working?
nClipEvent (load) {
stopped = true;
myCTR = -1;
w = 0;
}
onClipEvent (enterFrame) {
if (myCTR<=_parent.ctr && myCTR>=0) {
if (stopped) {
w = Math.ceil((random(60)+1)/10);
if (w == 1) {
if (myBall == 1) {
myBall = 2;
} else if (myBall == 2) {
myBall = 1;
}
} else if (w == 2) {
if (myBall == 3) {
myBall = 4;
} else if (myBall == 4) {
myBall = 3;
}
} else if (w == 3) {
if (myBall == 3) {
myBall = 2;
} else if (myBall == 2) {
myBall = 3;
}
} else if (w == 4) {
if (myBall == 3) {
myBall = 1;
} else if (myBall == 1) {
myBall = 3;
}
} else if (w == 5) {
if (myBall == 2) {
myBall = 4;
} else if (myBall == 4) {
myBall = 2;
}
} else if (w == 6) {
w = random(3)+6;
}
gotoAndPlay("f"+String(w));
myCTR++;
stopped = false;
}
} else if (_parent.ctr>4 && myCTR>_parent.ctr) {
if (_parent._currentframe != 5) {
if (w == 1) {
if (myBall == 1) {
myBall = 2;
} else if (myBall == 2) {
myBall = 1;
}
} else if (w == 2) {
if (myBall == 3) {
myBall = 4;
} else if (myBall == 4) {
myBall = 3;
}
} else if (w == 3) {
if (myBall == 3) {
myBall = 2;
} else if (myBall == 2) {
myBall = 3;
}
} else if (w == 4) {
if (myBall == 3) {
myBall = 1;
} else if (myBall == 1) {
myBall = 3;
}
} else if (w == 5) {
if (myBall == 2) {
myBall = 4;
} else if (myBall == 4) {
myBall = 2;
}
}
_parent.gotoAndStop(5);
gotoAndStop("guess");
}
}
}
