Stillwell
11-11-2004, 01:45 PM
I'm trying to make a randomized 6 sided die, but I'm having some trouble. Here is my code:
on (release) {
num = Math.round(Math.random()*6);
if (num=0) {
terning.gotoAndStop(1);
}
if (num=1) {
terning.gotoAndStop(2);
}
if (num=2) {
terning.gotoAndStop(3);
}
if (num=3) {
terning.gotoAndStop(4);
}
if (num=4) {
terning.gotoAndStop(5);
}
if (num=5) {
terning.gotoAndStop(6);
}
It's placed on a button, and the die is a 6 frame movieclip, with a stop action on each frame. My problem is that it seems that the randomizer makes num equal 6 every single time, and I can't figure out why. :confused:
Any help is appreciated.
on (release) {
num = Math.round(Math.random()*6);
if (num=0) {
terning.gotoAndStop(1);
}
if (num=1) {
terning.gotoAndStop(2);
}
if (num=2) {
terning.gotoAndStop(3);
}
if (num=3) {
terning.gotoAndStop(4);
}
if (num=4) {
terning.gotoAndStop(5);
}
if (num=5) {
terning.gotoAndStop(6);
}
It's placed on a button, and the die is a 6 frame movieclip, with a stop action on each frame. My problem is that it seems that the randomizer makes num equal 6 every single time, and I can't figure out why. :confused:
Any help is appreciated.