Dim x as integer = input
if x <> 0 then
'continue
else
'request new input
end if
Dim x as integer = input
Dim a as integer = input
Dim b as integer = input
Dim y as integer = ax + b
Dim a As Double = TextBox1.Text
Dim b As Double = TextBox2.Text
Dim c As Double = TextBox3.Text
Dim x1 as Double = (-b + math.sqrt(b ^ 2 - 4 * a * c)) / (2 * a)
Dim x2 as Double = (-b - math.sqrt(b ^ 2 - 4 * a * c)) / (2 * a)
Public function collision(object1 as control, object2 as control) as Boolean
if object1.Left >= object2.Left + object2.Width Then
return false
Else
If object1.Left + object1.Width <= object2.Left Then
return false
Else
If object1.Top >= object2.Top + object2.Height Then
return false
Else
If object1.Top + object1.Height <= object2.Top Then
return false
Else
return true
End If
End If
End If
End If
End Sub
Public Structure locations_per_sec
Dim time As Integer
Dim XLoc As Double
Dim YLoc As Double
End Structure
Private a As Double
Private Vp As Double
Private Vh As Double
Private Vv As Double
Private H As Double
Public Property angle() As Double
Get
Return a
End Get
Set(ByVal value As Double)
If -1 < value And value < 91 Then
a = value
Else : a = 45
End If
End Set
End Property
Public Property speed() As Double
Get
Return Vp
End Get
Set(ByVal value As Double)
Vp = value
End Set
End Property
Public Function location_times(Optional ByVal Height As Double = 5.0) As List(Of locations_per_sec)
Dim z As New List(Of locations_per_sec)(0)
Dim time As Integer = 0
Dim XLoc As Double = 0
Dim YLoc As Double = 0
h = Height
Dim sec As New locations_per_sec
angle = angle * math.pi / 180
Vh = Vp * Math.Cos(angle)
Vv = Vp * Math.Sin(angle)
Do Until YLoc < 0
time += 1
XLoc = Vh * time
YLoc = H + Vv * time - 0.5 * 32 * time ^ 2
sec.time = time
sec.XLoc = XLoc
sec.YLoc = YLoc
z.Add(sec)
Loop
Return z
End Function
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (0)