Nochte
10-18-2002, 06:06 PM
Please go easy on me... Very new to Actionscripting.
I am just trying to make 10 box bounce around.
I made one box bounce, and then went back to try to modify the script to add 9 more. and have done something obviously wrong. please advise. mold me. teach me.
Array(xdir,ydir,speed);
for(a=1;a<10;a++) {
duplicateMovieClip (_root.box, "box"+a, a);
xdir[a]=Math.random()*5;
ydir[a]=Math.random()*5;
speed[a]=3;
setProperty ("box"+a, _x, Math.random()*300);
setProperty ("box"+a, _y, Math.random()*300);
}
onEnterFrame = function() {
for(a=1;a<10;a++);
if("box"+a._x>300 or "box"+a._x<0) {
xdir[a]=xdir[a]*-1;
}
if("box"+a._y>300 or "box"+a._y<0) {
ydir[a]=ydir[a]*-1;
}
"box"+a._x+=(speed[a]*xdir[a]);
"box"+a._y+=(speed[a]*ydir[a]);
"box"+a._rotation+=5
};
Once you stop laughing, feel free to throw some advice my way.
Nochte.
I am just trying to make 10 box bounce around.
I made one box bounce, and then went back to try to modify the script to add 9 more. and have done something obviously wrong. please advise. mold me. teach me.
Array(xdir,ydir,speed);
for(a=1;a<10;a++) {
duplicateMovieClip (_root.box, "box"+a, a);
xdir[a]=Math.random()*5;
ydir[a]=Math.random()*5;
speed[a]=3;
setProperty ("box"+a, _x, Math.random()*300);
setProperty ("box"+a, _y, Math.random()*300);
}
onEnterFrame = function() {
for(a=1;a<10;a++);
if("box"+a._x>300 or "box"+a._x<0) {
xdir[a]=xdir[a]*-1;
}
if("box"+a._y>300 or "box"+a._y<0) {
ydir[a]=ydir[a]*-1;
}
"box"+a._x+=(speed[a]*xdir[a]);
"box"+a._y+=(speed[a]*ydir[a]);
"box"+a._rotation+=5
};
Once you stop laughing, feel free to throw some advice my way.
Nochte.