notquitehere188
Jan 13th, 2005, 07:15 PM
I have this code
it is suppoed to find all the variables for Y = MX + B and use them to find if the aim line goes through the left side of the player but it does not work
For X = 1 To MaxBullets
With Bullet(X)
If .Visible = True Then
L1 = .Left - .Xinertia
L2 = .Left
T1 = (.Top - .Yinertia)
T2 = .Top
M = (T2 - T1) / (L2 - L1)
B = T1 - (M * L1)
End If
End With
For Y = 1 To PlayerCount
With player(Y)
'if the line goes over the point then it is true
'Uses Y = MX + B
' Y MX +B
If .Top < (M * .Left) + B Then Cnr(1) = True
If .Top < (M * (.Left + .Width)) + B Then Cnr(2) = True
If (.Top + .Height) < (M * .Left) + B Then Cnr(3) = True
If (.Top + .Height) < (M * (.Left + .Width)) + B Then Cnr(4) = True
End With
If Cnr(1) = False And Cnr(3) = True Then
Bullet(X).Visible = False
End If
Next Y
Next X
HELP!!! :cry: :cry: :cry:
it is suppoed to find all the variables for Y = MX + B and use them to find if the aim line goes through the left side of the player but it does not work
For X = 1 To MaxBullets
With Bullet(X)
If .Visible = True Then
L1 = .Left - .Xinertia
L2 = .Left
T1 = (.Top - .Yinertia)
T2 = .Top
M = (T2 - T1) / (L2 - L1)
B = T1 - (M * L1)
End If
End With
For Y = 1 To PlayerCount
With player(Y)
'if the line goes over the point then it is true
'Uses Y = MX + B
' Y MX +B
If .Top < (M * .Left) + B Then Cnr(1) = True
If .Top < (M * (.Left + .Width)) + B Then Cnr(2) = True
If (.Top + .Height) < (M * .Left) + B Then Cnr(3) = True
If (.Top + .Height) < (M * (.Left + .Width)) + B Then Cnr(4) = True
End With
If Cnr(1) = False And Cnr(3) = True Then
Bullet(X).Visible = False
End If
Next Y
Next X
HELP!!! :cry: :cry: :cry: