作者:Utopia | 来源:互联网 | 2023-05-18 09:48
Basicallyiamworkingthroughabookcalled..FoundationActionscript3.0Animation,makingthingsm
Basically i am working through a book called..Foundation Actionscript 3.0 Animation, making things move.
基本上我正在写一本名为“基础动作脚本3.0动画”的书,让事情发生变化。
i am now on Chapter 9 - collision detection. On two lines of my code i get the 1135 error, letting me know that i have an incorrect number of arguments. Can anybody help me out on why this may be?
我现在在第9章 - 碰撞检测。在我的代码的两行中,我得到了1135错误,让我知道我的参数数量不正确。任何人都可以帮我解释为什么会这样吗?
package
{
import flash.display.Sprite;
import flash.events.Event;
public class Bubbles extends Sprite
{
private var balls:Array;
private var numBalls:Number = 10;
private var centerBall:Ball;
private var bounce:Number = -1;
private var spring:Number = 0.2;
public function Bubbles()
{
init();
}
private function init():void
{
balls = new Array();
centerBall = new Ball(100, 0xcccccc);
addChild(centerBall);
centerBall.x = stage.stageWidth / 2;
centerBall.y = stage.stageHeight / 2;
for(var i:uint = 0; i stage.stageWidth)
{
ball.x = stage.stageWidth - ball.radius;
ball.vx *= bounce;
}
else if(ball.x - ball.radius <0)
{
ball.x = ball.radius;
ball.vx *= bounce;
}
// Having Trouble Here:
if(ball.y + ball.radius > stage.stageHeight)
{
ball.y = stage.stageHeight - ball.radius;
ball.vy *= bounce;
}
else if(ball.y - ball.radius <0)
{
ball.y = ball.radius;
ball.vy *= bounce;
}
}
}
}
I have indicated the lines i am having trouble with.
我已经指出我遇到麻烦了。
1 个解决方案