-
[Need Help]
while throwing the ball in the different direction from the center of the stage,
the ball should zoomout.
Thanks.
Praful.
-
anyone else hear that?
Just adjust the ._xscale and ._yscale relative to the distance from the center of the stage.
Hope that helps!
Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.
-
i tried that earlyer,but the.xscale &._yscale are geting biger and biger
Please see the code:
stop();
startX = Stage.width/2;
//where the balls start, x-value
startY = Stage.height/2;
//where the balls start, y-value
ballNum = 3;
//this is how many balls we will have
speed = .1;
//the speed of the balls
scaleable = 30;
for (i=0; i<ballNum; i++) {
//create the balls
//attach the MC to the stage and store it temporary in the variable ball
ball = attachMovie("ball", "ball"+i, i);
//(linkage name, new name ball0, ball1, etc, and depth i)
//Put the ball in the middle of the stage
ball._x = startX;
ball._y = startY;
//Make a random angle for each ball, in radians. Degrees goes from 0-360 degrees, radians is the same, it just goes from 0-2*PI, or 0-6.28.
//Math.random() returns a number between 0 and 1.
ball.angle = Math.random()*Math.PI*2;
//set the x and y-speed for this ball
ball.xSpeed = Math.cos(ball.angle);
ball.ySpeed = Math.sin(ball.angle);
}
this.onEnterFrame = function() {
//loop through all balls
for (i=0; i<ballNum; i++) {
//put the ball in a temporary variable "ball"
ball = this["ball"+i];
//add xspeed and yspeed to the _x and _y variable
ball._x += ball.xSpeed;
ball._y += ball.ySpeed;
ball._xscale += ball.xSpeed;
ball._yscale += ball.ySpeed;
if (ball._xscale == 200 && ball._yscale == 200) {
ball._xscale = 60;
ball._yscale = 60;
scaleable = 30;
}
if (mc1.hitTest(this.ball)) {
//trace("Ball name = "+this.ball._name);
//this.ball0.gotoAndPlay("end");
}
}
};
-
anyone else hear that?
Not sure where you want to change the scale of the ball...when I put this code in a movie, create a ball object and run it, the balls just appear and drift with no interaction. Do you want them all to get smaller the farther they get from the center?
Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|