Fw: [討論] 用flash製作擲骰子的ActionScript
※ [本文轉錄自 Flash 看板 #1ElrPRrm ]
作者: sxazdc (沒啥好說的!) 看板: Flash
標題: [問題] 用flash製作擲骰子的ActionScript
時間: Sun Nov 13 13:32:09 2011
目前在製作一個擲骰子的Flash,
可否幫我看一下ActionScript中的if哪裡有錯誤?
(fred是第一個骰子,etherl是第二個骰子)
有三個if,
第一個是當擲出兩個點數相同的骰子時,會出現"You won!"的文字;
第二個是當擲出兩個點數和為七的時候,會出現"You lose!"的文字;
第三個是既不是相同點數也不是七的時候,不會出現任何文字。
fred.stop();
ethel.stop();
fred.buttonMode=ethel.buttonMode=true;
function rollDice(MouseEvent){
fred.gotoAndStop(Math.ceil(Math.random()*6));
ethel.gotoAndStop(Math.ceil(Math.random()*6));
if(fred==ethel){
doubles_txt.text="You won!";
}
if(fred+ethel=7){
seven_txt.text="You lose!"
}else{
doubles_txt.text="";
seven_txt.text="";
}
}
fred.addEventListener(MouseEvent.CLICK, rollDice);
etherl.addEventListener(MouseEvent.CLICK, rollDice);
謝謝!
※ 編輯: sxazdc 來自: 75.13.92.16 (11/13 13:34)
※ 發信站: 批踢踢實業坊(ptt.cc)
※ 轉錄者: sxazdc (75.13.92.16), 時間: 11/13/2011 13:37:22
※ 編輯: sxazdc 來自: 75.13.92.16 (11/13 14:02)
→
11/13 14:46, , 1F
11/13 14:46, 1F
推
11/13 18:11, , 2F
11/13 18:11, 2F
→
11/13 18:12, , 3F
11/13 18:12, 3F
→
11/13 18:12, , 4F
11/13 18:12, 4F
→
11/13 18:27, , 5F
11/13 18:27, 5F
推
11/13 19:06, , 6F
11/13 19:06, 6F
→
11/13 19:07, , 7F
11/13 19:07, 7F
→
11/13 19:07, , 8F
11/13 19:07, 8F