Image Collision

BlitzMax Forums/BlitzMax Beginners Area/Image Collision

I'm sure this is pretty simple, when you have an image collision does it also include the alpha pixels?

Like if I have an image that's on top of the player, but the inside is (0,0,0) and that's the masked color, does ImagesCollide register it?

It doesn't use alpha or mask in the collision test. A quick test suggests it causes a bit of slowdown though if you have an image within a hole of another and you're checking collisions.

so it records the collision then?

No. Sorry I can see how it is poorly worded. Alpha and mask pixels are not included in the collision test. I think the performance issue is because a rect collision is performed first (I think).
Anyway, it should be simple to test using :
Strict


Graphics 640,480

AutoMidHandle True	'image will rotate around it's center

Local image:TImage=LoadImage("circle.png")     '64*64 with 20 diameter circle
Local image2:timage=LoadImage("hollow_rect.png") ' 64*64 hollow rect
Local x:Int,y:Int
While Not KeyHit(KEY_ESCAPE)
	Cls
	ResetCollisions

' draw the first image at 5 times the size and on an arbitrary angle
	

	DrawImage image2,200,200

' add the first image to the first collision layer at same postion, rotation 
' and scale as it has just been drawn

	CollideImage image2,200,200,0,0,1

' move the other image relative to the mouse and rotate it continuously

	x=MouseX()
	y=MouseY()-20

	DrawImage image,x,y

' test the image at it's current rotation, scale and position with images
' that have been added to the first collision layer

	If CollideImage(image,x,y,0,1,0)

' reset scale and rotation states so our text is drawn correctly		
		DrawText "COLLISION!",20,20

	EndIf

	Flip
Wend