Results 1 to 2 of 2

Thread: Collission Detection

  1. #1

    Thread Starter
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg Ø, Denmark
    Posts
    1,544
    I have to lines on a form....
    Line1 is "standing up", line1 is laying down.
    I'm moving Line2 towards line1, and want to detect thwn the "tip" of Line2 touches Line1..

    I have the following code:

    Code:
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    
    Private Sub Timer1_Timer()
    If GetAsyncKeyState(vbKeyLeft) Then
        Line2.X1 = Line2.X1 - 80
        Line2.X2 = Line2.X2 - 80
        
    End If
    
    If GetAsyncKeyState(vbKeyRight) Then
        Line2.X1 = Line2.X1 + 80
        Line2.X2 = Line2.X2 + 80
        If Line2.X1 > Line1.X2 Then
            Me.Caption = "Colission!"
        End If
    End If
    
    If GetAsyncKeyState(vbKeyUp) Then
        Line2.Y1 = Line2.Y1 - 80
        Line2.Y2 = Line2.Y2 - 80
    End If
    
    If GetAsyncKeyState(vbKeyDown) Then
        Line2.Y1 = Line2.Y1 + 80
        Line2.Y2 = Line2.Y2 + 80
    End If
    
    
    End Sub
    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

  2. #2

    Thread Starter
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg Ø, Denmark
    Posts
    1,544
    Never mind guys! I figures it out!
    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

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