VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Collision Detection

by gunti (6 Submissions)
Category: Games
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (5 Votes)

This is an example in how to proove if there is a collision between object A and object B. There are already some codes like this here, but all i've seen so far, did not work very well, so here is my solution...

Rate Collision Detection

if A.left + A.width > B.left then
 if A.left < B.left + B.width then
 if A.top < B.top + B.height then
 if A.top + A.height > B.top then 
 'Collission Detected.
 'further actions here
 MsgBox "collission detected"
 else
 'no collission
 'further actions here
 MsgBox "no collision"
 end if
 end if
 end if
end if

Download this snippet    Add to My Saved Code

Collision Detection Comments

No comments have been posted about Collision Detection. Why not be the first to post a comment about Collision Detection.

Post your comment

Subject:
Message:
0/1000 characters