Quote Originally Posted by Robert Kosek
Hello,

Your problem is in procedure Tform1.colision; because you loop through the balls twice. You might have more than one problem, but this is the one I really see.

You only have two balls, and you know this, so why do you check the collision of the balls twice in nested for-loops? If ball 1 collided with ball 2, obviously ball 2 collided with 1! Yet, you loop through and check again. This is where the strange behavior comes in. To use a for loop with this sort of thing, you'll have to "register" collisions to avoid, uh, collision collisions.... How to make that less wacky and more understandable? Ah, prevent duplicate collisions. Sorry, for a second there I got stuck between cars in my train of thought.
...

Thx for the help! ;]

i will try what u say, but just one thing, i think the loop is necessary because the original source have 4 balls (you can see the dynamic array), isn't it ?


*from brazil so sorry my english