I'm having some problems with the collision detection for this breakout game of mine. The stuff I'm looking at is in the checkBlocks function. The ball moves very erratically. As you can see I've tried quite a few things. First I just put the positions of the blocks in some variables inside the for loop, then I tried putting them in an array at the top of the code (before the startGame function). Both give the same results. The if statements (commented and uncommented) all look fine to me. Does anyone know what's wrong?