how do I get all the x-value and y-value of all objects in the world and work out the distances between them? All objects in the world are from two different classes.
Please read this.
It's not clear to me exactly what you want, and anyway you need to show some evidence that you have actually thought about the problem yourself.