我对所有这些 Flash CS6 动作脚本 3.0 的东西都很陌生,我希望找到一些不同的方法来在 AS3 的影片剪辑阵列上应用罕见的丢弃机会。我有一个随机机会代码,它对敌人非常有效,因为他们经常掉下来,但我希望我的玩家很少掉心,以便抓住并获得生命。
这是我到目前为止的代码,它掉了太多的心。我试过摆弄这些数字,但我似乎只会让它变得更糟。有什么建议么?
function makeHeart():void
{
var chance:Number = Math.floor(Math.random() * 60);
if (chance <= 1 + level)
{
var tempHeart:MovieClip;
tempHeart = new Heart();
tempHeart.speed = 3;
tempHeart.x = Math.round(Math.random() * 800);
tempHeart.cacheAsBitmapMatrix = tempHeart.transform.concatenatedMatrix;
tempHeart.cacheAsBitmap = true;
trace("tempHeart");
addChild(tempHeart);
hearts.push(tempHeart);
}
}