Thanks, skid! Finally I have created a little function that does the hard part, using your idea.
This function just use CollideImage, but returns an array *without* the object we are testing. It seems much more logical to do things like this. Maybe something similar could be implemented directly in collideImage???
Anyway, I use it like this:
CollideImage2(x,y,frame,0,playerLayer,player) (collideImage would work as well)
Then, later on, to check collisions:
if collideImage2(x, y, frame, playerLayer, 0, null, self) then blah
Here is it:
This function just use CollideImage, but returns an array *without* the object we are testing. It seems much more logical to do things like this. Maybe something similar could be implemented directly in collideImage???
Anyway, I use it like this:
CollideImage2(x,y,frame,0,playerLayer,player) (collideImage would work as well)
Then, later on, to check collisions:
if collideImage2(x, y, frame, playerLayer, 0, null, self) then blah
Here is it:
' Function checking the collision, but will remove the testedObject from the list of collision. This allows ' collision for objects of the same layer. Function CollideImage2:Object[](image:TImage, x, y, frame, collideMask%, writeMask%, id:Object, testedObject:Object=Null) Local collidedObjects:Object[] = CollideImage(image, x, y, frame, collideMask, writeMask, id) ' Test if the object is present in the collision list Local testedObjectPresent:Byte = False For Local collidedObject:Object = EachIn collidedObjects If collidedObject = testedObject Then testedObjectPresent = True Next ' Create the new array we will return Local dim If testedObjectPresent Then dim = collidedObjects.length - 1 Else dim = collidedObjects.length Local collidedObjectsReturned:Object[dim] ' Remove the object from the collision list if it's present Local i = 0 For Local collidedObject:Object = EachIn collidedObjects If collidedObject <> testedObject Then collidedObjectsReturned[i] = collidedObject i:+1 EndIf Next Return collidedObjectsReturned End Function