In answer to your specific question, the only way you can do what you are asking is to have some sort of collection containing all of the objects you want to check for collision - so the simplest would be an array of dsSpaceEntity that you iterate over.
For i = 0 to sizeOfArray
For j = i to sizeofArray
if Hascollided(Array(i), Array(j)) Then
doStuff(i,j)
End If
Next
Next
But as you say, with a large number in the array this will take time. Using a more complex structure might help. One of the simplest things you can do is eliminate the need to test for collisions as soon as possible. If each object has a left, right, top, bottom property then if the Top of one is lower than the bottom of another, no more testing is required. Do these tests first so you don't do anything more complex unless you have to (for example I have objects with complex shapes, so checking collisions is very time consuming - but I first check for a small number of large rectangles, only looking at the detail level after eliminating as may as possible by other tests. You can also use a radius and center point for each object - and simply calculate the distance between the center points - eliminating further checking if this distance > sum of radii Assuming that MOST collision tests are negative, it is worthwhile doing many tests, eliminating as many as possible as early as possible - e.g. test the top vs bottom, then left vs right, then distance apart - if the two objects fail all three tests there's a fair chance they've collided - so do any further tests (depending on your shape's complexity) And hey, why not post some of your games for us to play comment on the code:)
MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')