Collisions id:object,doesn't work. What am I doin?

BlitzMax Forums/BlitzMax Programming/Collisions id:object,doesn't work. What am I doin?

skn3(Posted 2005) [#1]
What am I doing wrong ? To my understanding this should return a list of the id:object's envolved in the collision.

Graphics 640,480,0,60

'type used in collision test
Type TCollide
	Field id:String
End Type

Local x:Int
Local y:Int

Local regionx:Int = 200
Local regiony:Int = 145
Local regionwidth:Int = 200
Local regionheight:Int = 182

Local collide:TCollide = New TCollide
collide.id = "region"

'add region to collision layer 1
CollideRect(regionx,regiony,regionwidth,regionheight,0,COLLISION_LAYER_1,collide)

Repeat
	x = MouseX()
	y = MouseY()
	Cls
	
	'check for collisions caused by mouse pointer
	Local temp:Object[] = CollideRect(x,y,1,1,COLLISION_LAYER_1,0,Null)
	If temp.length
		'list all object ids collided with
		SetColor 155,155,155
		DrawText "collided with:",5,25
		Local drawy:Int = 45
		For i:Int = 0 Until temp.length
			Local collideobject:TCollide = TCollide(temp[i])
			If collideobject
				DrawText "id="+collideobject.id,15,drawy
				drawy:+20
			End If
		Next
		'set color for displaying region rect
		SetColor 0,255,0
	Else
		'set color for displaying region rect
		SetColor 255,0,0
	End If
	
	'raw simple interface
	DrawRect regionx,regiony,regionwidth,regionheight
	SetColor 255,255,255
	DrawText "Mouse over red box...",5,5
	
	Flip
Until KeyDown(KEY_ESCAPE)



teamonkey(Posted 2005) [#2]
It's a bug: http://blitzbasic.com/Community/posts.php?topic=44068


skn3(Posted 2005) [#3]
Ah right, that fixed it. Thanks