R
robee31
Guest
I am learning vb and I am not understanding what this error means.
I have a form "playground" that a ball should bounce in. I have a seperate class "Ball" that I am to separate the draw methods and the move methods for the ball and I get an error when I call the MoveBall method. I am also not sure I should have a sleep thread in my code to show the ball moving..
Public
Sub CreateBall(ByVal DrawIN As Graphics) ' Draw The ball
Dim X As Integer = 1 ' Horizontal Velocity
Dim Y As Integer = 1 ' Vertical Velocity
Dim Z As Integer = 1
Dim frmDimensions As New frmBounceyBall
MsgBox(frmWidth &
" & " & frmHeight)
DrawIN.DrawEllipse(Pens.Blue, intXCoord, intYCoord, 20, 20)
' shape
DrawIN.FillEllipse(Brushes.Blue, intXCoord, intYCoord, 20, 20)
'fill color
MoveBall(
ByVal DrawIn As Graphics) <<<---- ERROR HERE
End Sub
Private Sub MoveBall(ByVal DrawIn As Graphics)
Do While Z < 1500
' New coordinates to appear as if it is moving
intXCoord += X
intYCoord += Y
X += 1
Y += 1
Z += 1
Thread.Sleep(10)
DrawIN.Clear(Color.Transparent)
If Me.intXCoord + 20 >= Me.frmWidth _
Then Me.intXCoord -= X
If Me.intYCoord + 20 >= Me.frmHeight _
Then Me.intYCoord -= Y
If Me.intXCoord + 20 <= 20 _
Then X = 21
If Me.intYCoord + 20 <= 20 _
Then Y = 21
Loop
MsgBox(Z, MsgBoxStyle.Exclamation)
End Sub
RPettis
Continue reading...
I have a form "playground" that a ball should bounce in. I have a seperate class "Ball" that I am to separate the draw methods and the move methods for the ball and I get an error when I call the MoveBall method. I am also not sure I should have a sleep thread in my code to show the ball moving..
Public
Sub CreateBall(ByVal DrawIN As Graphics) ' Draw The ball
Dim X As Integer = 1 ' Horizontal Velocity
Dim Y As Integer = 1 ' Vertical Velocity
Dim Z As Integer = 1
Dim frmDimensions As New frmBounceyBall
MsgBox(frmWidth &
" & " & frmHeight)
DrawIN.DrawEllipse(Pens.Blue, intXCoord, intYCoord, 20, 20)
' shape
DrawIN.FillEllipse(Brushes.Blue, intXCoord, intYCoord, 20, 20)
'fill color
MoveBall(
ByVal DrawIn As Graphics) <<<---- ERROR HERE
End Sub
Private Sub MoveBall(ByVal DrawIn As Graphics)
Do While Z < 1500
' New coordinates to appear as if it is moving
intXCoord += X
intYCoord += Y
X += 1
Y += 1
Z += 1
Thread.Sleep(10)
DrawIN.Clear(Color.Transparent)
If Me.intXCoord + 20 >= Me.frmWidth _
Then Me.intXCoord -= X
If Me.intYCoord + 20 >= Me.frmHeight _
Then Me.intYCoord -= Y
If Me.intXCoord + 20 <= 20 _
Then X = 21
If Me.intYCoord + 20 <= 20 _
Then Y = 21
Loop
MsgBox(Z, MsgBoxStyle.Exclamation)
End Sub
RPettis
Continue reading...