_root.stop(); //停止時間軸
_root.truewinner = 0;
_root.guesswinner = 0;
_root.wn1._x += random(10)/10+random(1); //蝸牛1號的X軸數(shù)據(jù)增加某一數(shù)值
_root.wn2._x += random(10)/10+random(1); //蝸牛2號的X軸數(shù)據(jù)增加某一數(shù)值
_root.wn3._x += random(10)/10+random(1); //蝸牛3號的X軸數(shù)據(jù)增加某一數(shù)值
_root.wn4._x += random(10)/10+random(1); //蝸牛4號的X軸數(shù)據(jù)增加某一數(shù)值
if (_root.wn1._x>540) {
_root.truewinner = 1;
}
if (_root.wn2._x>540) {
_root.truewinner = 2;
}
if (_root.wn3._x>540) {
_root.truewinner = 3;
}
if (_root.wn4._x>540) {
_root.truewinner = 4;
}
//判斷哪只蝸牛到了,到了就改變truewinner的值,紀錄哪只蝸牛獲勝
if (_root.truewinner != 0) {
if (_root.guesswinner == _root.truewinner) {
_root.gotoAndStop(4);
} else {
_root.gotoAndStop(5);
}
} else {
_root.gotoAndPlay(2);
}
/*--------------------------------------------
判斷truewinner的值,如果被改變了,說明已經(jīng)有蝸牛到了
如果還沒有改變,說明蝸牛們還沒到。
如果沒到,就把_root的指針跳到第2幀,讓他們繼續(xù)跑,如果到了,
判斷玩家壓的那只和真正到的那只是不是一樣。如果猜對了,讓時間
指針跳停到第4幀,否則跳停到第5幀。
---------------------------------------------*/
on(release){
_root.play();
_root.guesswinner = 1;
}
on(release){
_root.gotoAndStop(1);
_root.wn1._x = 25;//蝸牛1號回起點
_root.wn2._x = 25;
_root.wn3._x = 25;
_root.wn4._x = 25;
}