Colliderect?
And this might help :
And this might help :
SuperStrict Type trect Global list:tlist=CreateList() Field x:Int Field y:Int Field w:Int Field h:Int Field r:Int Field g:Int Field b:Int Function Create(x:Int , y:Int , w:Int , h:Int) Local temp:trect = New trect temp.x = x temp.y = y temp.w = w temp.h = h ListAddLast list , temp End Function Function rectdraw() For Local all:trect = EachIn list all.draw() Next SetColor 255,255,255 End Function Method draw() SetColor r , g , b DrawRect x , y , w , h End Method Function colrect(x:Int , y:Int , w:Int , h:Int) Local numcol:Int For Local all:trect = EachIn list Local hit:Int = all.checkcol(x , y , w , h) If hit numcol:+1 Next SetColor 255,0,0 DrawText "There have been : " + numcol + " collisions" , 0 , 0 SetColor 255,255,255 End Function Method checkcol:Int(xpos:Int , ypos:Int , width:Int , height:Int) If xpos > x And xpos + width < x + w And ypos > y And ypos + height < y + h r = 255 g = 0 b=0 Return 1 Else r = 255 g = 255 b=255 Return 0 EndIf End Method End Type Graphics 640 , 480 SeedRnd MilliSecs() For Local loop:Int = 0 To 10 trect.create(Rand(0 , 540) , Rand(0 , 380) , 100 , 100) Next While Not KeyHit(KEY_ESCAPE) Cls Local mx:Int = MouseX() Local my:Int=MouseY() trect.rectdraw trect.colrect(mx - 1 , my - 1 , 2 , 2) Flip Wend