This content has been marked as final. Show 7 replies
you only need one loop to update the stage.
when a bal is created assign a property to it so it can retrieve its "direction" of travel and update its _x and _y properties using its "direction". store the bal in an array that you loop through in your loop that updates the stage.
I changed my script in a way that the values are connected to the movieclips.
And if you now drag the left square up and down fast the dots still move in the same direction.
The only thing now is that if the line is horizontal the speed of the ball is too fast. Sometimes it's so fast you can't see
it move. Is there a way to have a constant speed of the dots? No matter in what angle they are?
I am not a Math. wizzard, but i noticed in your profile (kglad) that you are!
Can you help me out ? Or anyone else for that matter
again, you only need one loop. you don't need a loop for each ball movieclip:
Hello Klgad, thanks for your efford. Unfortuneately it did not work :(
I have some questions about your code.
In line 7 and 8 you add (hoek._width*Math.cos(cstan) ..but i don't know why? Because when
i remove it, the starting point is now correct.
pointerBal._x = hoek._x ;
pointerBal._y = hoek._y ;
Also if you drag the movieclip (basis) around ..sometimes the shooting dots get removed.
The dots travel in the right corner, but when they reach the edge of the stage they are not removed.
When i removed the line at 28 (balA.splice(i,1), they are removed properly.
When i trace BalA (in the function newBal) ..the array get's bigger and bigger.
Doesn't it slow your program when this is looping for a while?
I hope you can take one last look at it.
1. the starting point is dependent on your registration point. your hoek reg pt must be where you want to bal's to start.
2. that should be:
mc = balA[ i ];
Thanks! I got it working now. I switch these lines in order.
that worked for me too :) and after tracing the array, it did not get bigger anymore.
I recently bought the book " Actionscriopt 3.0 " Animation -making things move. I hope to improve my Math skills
after reading this.
Thanks for helping out!
this is as2, so you'll need to redo things for an as3 application.