2014-05-25 33 views
0

我在動作中製作棋盤遊戲我已經制作了骰子的腳本。 這是它的工作原理。 當您單擊按鈕時,屏幕上會顯示1到6之間的兩個隨機數字。 但我不知道如何爲pion製作腳本,我怎樣才能讓它移動相同數量的骰子。 這裏是我的骰子的腳本移動pion動作

btn.addEventListener(MouseEvent.CLICK, throw); 
    function throw(event:MouseEvent):void { 
// math random for dices 1 -- 6 
dice1 = Math.floor(Math.random() * 6 + 1); 
dice2 = Math.floor(Math.random() * 6 + 1); 
// Dice1 + Dice2 
diceT = dice1 + dice2; 
dice1_txt.text = dice1.toString(); 
dice2_txt.text = dice2.toString(); 
diceT_txt.text = "You have thrown " + diceT ; 
    } 
+0

那麼這是不能解釋的東西。有許多選項和方法可以做到,所以只需開始嘗試。 –

回答

0

準備六幅圖像的數字1至6.使用精靈繪製介子的第一個孩子和數字作爲第二個孩子。