reepnorp
01-16-2005, 05:58 PM
With this code, the collision only seems to work sometimes. Anyone know why?
If intShipOneLeft >= intShipTwoLeft And intShipOneLeft <= intShipTwoRight Then
'If the left variables are either the same, or the first ship's is higher; and the
'first ships left variable is either smaller than, or equal to the second' right
blnLeftBetween = True 'The first ship's left side is hitting the second's right
blnRightBetweenTwo = True 'The second ship's right side is hitting the first's left
Else: blnLeftBetween = False 'Otherwise they aren't
blnRightBetweenTwo = False
End If
If intShipOneRight >= intShipTwoRight And intShipOneRight <= intShipTwoRight Then
'If the right variables are either the same, or the first ship's is higher; and the
'first ships right variable is either smaller than, or equal to the second's left
blnRightBetween = True 'The first ship's right side is hitting the second's left
blnLeftBetweenTwo = True 'The second ship's left side is hitting the first's right
Else: blnRightBetween = False 'Otherwise they aren't
blnLeftBetweenTwo = False
End If
If intShipOneTop >= intShipTwoTop And intShipOneTop <= intShipTwoBottom Then
'If the top variables are either the same, or the first ship's is higher; and the
'first ships top variable is either smaller than, or equal to the second's bottom
blnTopBetween = True 'The first ship's top is hitting the second's bottom
blnBottomBetweenTwo = True 'The second ship's bottom is hitting the first's top
Else: blnTopBetween = False 'Otherwise they aren't
blnBottomBetweenTwo = False
End If
If intShipOneBottom >= intShipTwoBottom And intShipOneBottom <= intShipTwoBottom Then
'If the bottom variables are either the same, or the first ship's is higher; and
'the first ships bottom variable is either smaller than, or equal to the second's top
blnBottomBetween = True 'The first ship's bottom is hitting the second's top
blnTopBetweenTwo = True 'The second ship's top is hitting the first's bottom
Else: blnBottomBetween = False 'Otherwise they aren't
blnTopBetweenTwo = False
End If
If intShipOneLeft >= intShipTwoLeft And intShipOneLeft <= intShipTwoRight Then
'If the left variables are either the same, or the first ship's is higher; and the
'first ships left variable is either smaller than, or equal to the second' right
blnLeftBetween = True 'The first ship's left side is hitting the second's right
blnRightBetweenTwo = True 'The second ship's right side is hitting the first's left
Else: blnLeftBetween = False 'Otherwise they aren't
blnRightBetweenTwo = False
End If
If intShipOneRight >= intShipTwoRight And intShipOneRight <= intShipTwoRight Then
'If the right variables are either the same, or the first ship's is higher; and the
'first ships right variable is either smaller than, or equal to the second's left
blnRightBetween = True 'The first ship's right side is hitting the second's left
blnLeftBetweenTwo = True 'The second ship's left side is hitting the first's right
Else: blnRightBetween = False 'Otherwise they aren't
blnLeftBetweenTwo = False
End If
If intShipOneTop >= intShipTwoTop And intShipOneTop <= intShipTwoBottom Then
'If the top variables are either the same, or the first ship's is higher; and the
'first ships top variable is either smaller than, or equal to the second's bottom
blnTopBetween = True 'The first ship's top is hitting the second's bottom
blnBottomBetweenTwo = True 'The second ship's bottom is hitting the first's top
Else: blnTopBetween = False 'Otherwise they aren't
blnBottomBetweenTwo = False
End If
If intShipOneBottom >= intShipTwoBottom And intShipOneBottom <= intShipTwoBottom Then
'If the bottom variables are either the same, or the first ship's is higher; and
'the first ships bottom variable is either smaller than, or equal to the second's top
blnBottomBetween = True 'The first ship's bottom is hitting the second's top
blnTopBetweenTwo = True 'The second ship's top is hitting the first's bottom
Else: blnBottomBetween = False 'Otherwise they aren't
blnTopBetweenTwo = False
End If