好吧,有人可以解释我的代码下面有什么问题,没有错误,但它没有做我想做的事情。当随机生成的名为“randint”的变量大于或等于0.5时,我需要它在屏幕上显示一个动画片段。如果不是,则不会显示。代码:AS3儿童问题与if语句
addEventListener(Event.ENTER_FRAME, char_coll);
function char_coll(ev : Event) : void
{
if(currentFrame==2)
{
if (randint >= 0.5){
var w1:woman1 = new woman1();
randint = Math.random();
if(w1.hitTestObject(stand)){
w1.gotoAndPlay(1);
cash1 = cash1 + 1;
}
}
}
};
值得注意的是,'randint'在这里是一个误称,因为Math.random返回0和1之间的浮点数。 – 2012-02-21 01:12:28