i.e. Lets say I have a one list of player bullets which I need to test against another list of enemy sprites, resulting the identity of the specific bullet/alien which collided.
Here's my attempt, bare in mind I'm not 100% sure of it all yet. Assuming bullet-to-alien collisions are the only ones you're interested in (not bullet-to-bullet etc):
Type TAlien Global AlienImage:TImage Global AlienList:TList Field X:Int Field Y:Int ... End Type Type TBullet Global BulletImage:TImage Global BulletList:TList Field X:Int Field Y:Int ... End Type '... Const ALIEN_LAYER = 1 ' Collision layer used for aliens Function DoCollisions() ResetCollisions ALIEN_LAYER For A:TAlien = EachIn TAlien.AlienList CollideImage(TAlien.AlienImage, A.X, A.Y, 0, 0, ALIEN_LAYER, A) Next Local AliensCollided:Object[] For B:TBullet = EachIn TBullet.BulletList AliensCollided = CollideImage(TBullet.BulletImage, B.X, B.Y, 0, ALIEN_LAYER, 0, Null) For i = 0 To Len(AliensCollided)-1 A:TAlien = TAlien(AliensCollided[i]) ' Alien = A ' Bullet = B Next Next End Function