移动pion actionscript

时间:2014-05-25 20:14:23

标签: actionscript-3 flash actionscript

我正在使用动作制作棋盘游戏我已经制作了骰子脚本。 下面是它的工作原理。 单击该按钮时,屏幕上将显示1到6之间的两个随机数。 但我不知道如何为π介子制作脚本如何使用相同数量的骰子移动它。 这是我的骰子脚本

    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 ;
    }

1 个答案:

答案 0 :(得分:0)

为数字1到6准备六张图片。使用精灵将pion绘制为第一个孩子,将数字绘制为第二个孩子。