Collision Detection Function
![Visual Basic 6, or VB Classic Visual Basic 6, or VB Classic](https://www.fortypoundhead.com//assets/img/icons/v7/vb6.png)
A small function to detect collision between 2 objects!
Original Author: Aymon Fournier
Code
Function IsCollide(Object1 As Object, Object2 As Object) As Boolean
Dim Ob1 As Object
Dim Ob2 As Object
Set Ob1 = Object1
Set Ob2 = Object2
If Ob1.Left < Ob2.Left + Ob2.Width And Ob1.Left + Ob1.Width > Ob2.Left And Ob1.Top < Ob2.Top + Ob2.Height And Ob1.Top + Ob1.Height > Ob2.Top Then
IsCollide = True
Else
IsCollide = False
End If
End Function
Please provide some feedback about this post.
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.