UPDATE随机闪光灯AS3弹跳球*更新*
我现在有这个,但是当flash动画运行
var array:Array = new Array;
var dx:Number = Math.random() * 20;
var dy:Number = Math.random() * 10;
var velX:Number = 5;
var velY:Number = 5;
addEventListener(Event.ENTER_FRAME, movearray);
for (var i:Number = 0; i < 20; i++) {
var ball:Ball = new Ball();
ball.x = Math.random() * 550;
ball.y = Math.random() * 400;
addChild(ball);
array.push(ball);
}
function movearray(evt:Event):void {
ball.x += velX;
ball.y += velY;
if (ball.x > stage.stageWidth - ball.width/2 || ball.x < 0 + ball.width /2){
velX *= -1;
}
else if (ball.y > stage.stageHeight - ball.height/2 || ball.y < 0 + ball.height /2){
velY *= -1;
}
}
感谢任何帮助赞赏只有一个球的反弹。
辉煌,感谢和你不知道的另一件事是我有工作的地方,球从左到右移动,并下降....像太空入侵者 – LochyMacleod 2012-03-31 17:46:59