[RESOLVED] [02/03] Need help comparing picturebox length
I'm trying to test some different types of collision detection. I've come across a problem when I try to do things with picture boxes.
I want to make it so the two floating picture boxes collide with eachother and bounce away at pre-determined angles. The problem I'm having is that my comparing statements don'twork properly.
Example:
If box1.Top < (box2.Top + box2.Height) Then
vmom = -(Math.Sin(90) + vmom) 'vmom is the vertical momentum
I think my problem is that I am comparing every value on the axes instead of just the coordinates and length of box2 (if that makes any sense). When I run it, box1 bounces off of every point where box1.Top < (box2.Top + box2.Height) is true. I have if statements for the other sides of box2 as well, they all have the same problem.
I'm running on VB.net 2003, any help would be greatly apreciated.
Re: [02/03] Need help comparing picturebox length
There is a Games Programming tutorial in my signature that includes some stuff about collision detection I believe. I've not read it in detail myself but it would probably be worth your while, even if it doesn't answer this specific question.
Re: [02/03] Need help comparing picturebox length
I'm an idiot... I had left a crucial line of code commented out from when I was fixing some other issues... it all works now. My apologies.
..that's what I get for programming at 5 am...