Thank you for the fast reply.

Surely my line of code that says if (ball1 != ball2) will prevent checking one ball against itself? There was a small typo in my code I typed in


[code]

for (var j = 0; i < howManyBalls; j++) {

[/code]

Should have been

[code]

for (var j = 0; j < howManyBalls; j++) {

[/code]

[code]


for (var i = 0; i < howManyBalls; i++) {

  ball1 = ballObjects[i]

 
  for (var j = 0; j < howManyBalls; j++) {

      ball2 = ballObjects[j]

      if (ball1 != ball2) {
       
        checkForCollisionWithBall(ball1, ball2 )
      }

  }


[/code]

If I use the following:

[code]
for (var j = i; i < howManyBalls; j++)
[/code]

Surely if i = 2 then j will never have a value of 0 or 1?

Thank you

Paul