Fixed bug in the detectCollision() function where the last line of the if statment used 'objects[y].height' instead of 'objects[x].height'