Results 1 to 2 of 2

Thread: collision detection help

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2004
    Posts
    15

    Question collision detection help

    Haven't done much math in VB.NET but here goes

    I'm making an educational lunar lander game with addition/subtraction and stuff. I can handle the math with that, but there's some collision detection that requires some math.

    The terrain at the bottom of the screen is made up with speed in mind. The resolution of the terrain is about 400heighth by 600width. Instead of having an array with 600 elements I have the terrain broken up into segments which is random which could be anything between 30-70. So 20-70 points are created and then I create line between each of the 20-70 points. As this increases the app in speed, it also makes the collision detection harder.

    Say I have two points 300,5 and 310,10

    this is kinda like one of those graphic math problems.

    I need to make a method that will tell me of the heighth of all of those points in between.

    I have 5 which is equal to 300
    I have 10 which is equal to 310
    I need to find the values of 6-9

    This is quite simple but my mind is just blank for some reason. All help is appreciated in advance. Thank you.
    -Phil


    Microsoft Certified Application Developer
    Microsoft Certified Professional
    COMPTia Network+

  2. #2

    Thread Starter
    New Member
    Join Date
    Sep 2004
    Posts
    15
    well i think I figured it all out, but for anyone wanting to implement something like this, you will need to know a couple formulas.

    The slope formula
    Code:
    y=(y2-y1)/(x2-x1)
    and the y-intercept formula (not sure if thats the technical term)
    Code:
    y=mx+b
    but since you are looking for b
    Code:
    b=y-mx
    please let me know if I screwed any of this up.

    once you have both formulas, you can determine the heighth of x by using y=mx+b
    -Phil


    Microsoft Certified Application Developer
    Microsoft Certified Professional
    COMPTia Network+

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