This content has been marked as final. Show 6 replies
What is the hitTest for? It's for stopping the ball or for bouncing?
If the ball doesn't have to go trough the wall, just build a transparent wall, wider than the thin line.
the hitTest detect the colusion between the ball and the wall. I cant build thick trnsparent wall becasue if the wall place horizontal, the ball should not colide with the wall when moving from left to right. I hope I am clear
don't use an onEnterFrame handler or timeline tween to move the ball. use setInterval() with a high enough frequency of calls that the movements per interval don't allow your ball to go past the wall without intersecting it. use the same loop to check the hitTest().
Thanks kglad. yea. I was thinking about this solution but I thought it might be too much of cpu process ( I have 25 balls on the screen) but it might be the only solution. Thanks again
If you wanna do the math, take a look at:
which has a tut on vecor based movement and collision detection.
> Thanks kglad. yea. I was thinking about this solution but I thought it might be too much of cpu process ( I have 25 balls on the screen) but it might be the only solution. Thanks again
you should have only one loop to update the 25 balls position. and you should consider enabling the cacheAsBitmap property of the 25 balls.