Search Tools Links Login

Collision Detection Function


Visual Basic 6, or VB Classic

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.

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 115 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.