Hi,
Gude me to on enterframe makes the balls fly out in differant directions from the center of the Stage.
ThankX.
Praful
Hi,
Gude me to on enterframe makes the balls fly out in differant directions from the center of the Stage.
ThankX.
Praful
please DON´T create multple threads on the same matter.
Hi,
Sir
tell me How you make the balls fly out in differant directions?
You could just use ANGLE = Math.random*360; beware that this is in degrees, you probably need to convert it to radians to use in Math.cos and sin, just look in flash help for how to do that.
By getting someone to kick your scrotum real hard.Quote:
Originally Posted by praful
Seriously mate, you post two threads on the same topic, someone points out ttat that's not appropriate behaviour, and you tell them - not ask them politely, no, you tell them - to explain something to you.
Sorry for the language that i used.Quote:
Originally Posted by Fall_X
i tryed, to do it of my own, one movieclip in moving,but remaing duplicates are not changing there angles and not moving.
Thanks.
Praful.
Then posting what you have done usually helps, because then you show that you actually have tried. Also post the code you have written, then maybe we can help you rewrite it so it works:)
we are NOT here to do other´s work, come with something that can be discussed about like T1ger suggested.
It propably will a onEnterFrame event and some trigonometry- but lets first show us what you got
Hi,
T1ger
this is the code:
stop();
speed = .2;
angle = 0;
raj.onEnterFrame = function() {
speed += speed;
angl++;
xpos = Math.cos(speed);
ypos = Math.sin(speed);
for (p=1; p<=6; p++) {
this["raj"+p]._rotation = angl;
this["raj"+p]._x += xpos;
this["raj"+p]._y += ypos;
}
};
I guess you have dragged 6 movieclips onto the stage and named them raj1 - raj6? Alternative to this is to create them dynamically. Right click on the MC in the library, and click "linkage", choose export for actionscript, and write "ball" in the identifier input field, then ok.
then you can put this in first frame:
Try to understand this, I have commented everything:)PHP Code:stop();
startX = Stage.width/2; //where the balls start, x-value
startY = Stage.height/2; //where the balls start, y-value
ballNum = 6; //this is how many balls we will have
speed = 2; //the speed of the balls
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;
}
}
Quote:
Originally Posted by T1ger
:)
Hi T1ger
this script works exectly i wanted to, Thakns once again for your help.
do you suggest any book or any article on the net to developed the scripting skill
Thanks once again!
Regards.
Praful.
Read the readme-thread http://board.flashkit.com/board/showthread.php?t=513006 if you havent already, and google tonypa, and read his excellent tile tutorials. They learn you making tile-based games, but also syntax and scripting:)