ImagesCollide problem

BlitzPlus Forums/BlitzPlus Programming/ImagesCollide problem

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'm using images collide but it sparks off at random points!

Its a 640x480 graphics size and this is the code to create a new enemy:

a% = Rand(1,120)
	
	If a = 5
		o.obsticle = New obsticle
		o\hnd = LoadImage("germanp.png")
		MaskImage o\hnd, 255, 0, 255
		o\kill = 1
		o\x = Rand(95,495)
		o\y = -25
	End If


Later on i use this very short thing to see if the images are overlapping:

For o.obsticle = Each obsticle
		
		If ImagesCollide(o\hnd, o\x, o\y, 0, player, px, py, 0)
			Print "SO"	
		End If
	Next


Both of these are contained in separate functions. The player co-ords involve the x changing as the player moves but the y staying the same and the enemy has the x staying the same and the y changing. The problem is, sometimes without even having the enemy on the screen it says the images have collided and sometimes it only happens when i get about 100 pixels away. But it always goes off withut the two images colliding. Its been a while since ive used Graphics mode but i don't think i have done anything wrong.

RectsOverlap and ImagesOOverlap also dont work.

Thanks for any help

Matt