[問題] 用flash製作擲骰子的ActionScript
目前在製作一個擲骰子的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)
※ sxazdc:轉錄至看板 CodeJob 11/13 13:37
※ 編輯: sxazdc 來自: 75.13.92.16 (11/13 14:01)
→
11/13 21:09, , 1F
11/13 21:09, 1F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
Flash 近期熱門文章
PTT數位生活區 即時熱門文章