Results 1 to 3 of 3

Thread: [RESOLVED] [02/03] Need help comparing picturebox length

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    4

    Resolved [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.
    Last edited by Kristina; Apr 10th, 2006 at 04:24 AM.
    Currently using VB.net 2003

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,449

    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.

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    4

    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...
    Currently using VB.net 2003

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width