Hey, in this game you can stack any falling ball onto another. I've been trying some code, and this is the closest I have gotten to work. As you can see the game is laggy and some balls disappear. Ignore the "10", those little dots, and the blue. My screwed up game.
So as you can see, if you connect the balls in series, there are no problems. But if you stack three or so in a row and then connect the fourth ball onto the first ball, some others will disappear.
Here's the code:
fallingBall.onEnterFrame = function(){
for (i=0; i<360; i+=5) {
X = this._x + (Math.cos(i*(Math.PI/180))*radius)+ _x;
Y = this._y + (Math.sin(i*(Math.PI/180))*radius)+ _y;
for(totalhits=0; totalhits<10; totalhits++){
if (floor.hitTest(X, Y, true) or _root["duplicatedBall" + totalhits].hitTest(X, Y, true)){
pointstop();
break;
}
}
}
function pointstop(){
totalhits+=1
_root.attachMovie("duplicatedBall", "duplicatedBall"+totalhits,totalhits,{_x:fallingBall._x, _y:fallingBall._y})
}
How can I prevent lag and get this to work?!