I'm using Visual Studio 2010 Professional.
I have one form (and its associated vb file) and another, separate vb file. When I go to compile and debug my code, my building succeeds, and the form displays, but the "ball" doesn't move.
My startup class:
Public Class Bouncer
Private bouncingBall As Ball
Private Sub CST8333_Lab3_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
bouncingBall = New Ball(Me)
'Me.Controls.Add(Ball)
End Sub
Private Sub Timer_Tick(sender As System.Object, e As System.EventArgs) Handles Timer.Tick
bouncingBall.MoveBall()
End Sub
End Class
My other, separate class:
Public Class Ball
Private ballX As Integer
Private ballY As Integer
Private ballMovementX As Integer
Private ballMovementY As Integer
Private _bouncer As Bouncer
Sub New(bouncer As Bouncer)
_bouncer = bouncer
ballX = 50
ballY = 50
ballMovementX = 5
ballMovementY = 5
End Sub
Public Function GetBallX() As Integer
Return ballX
End Function
Public Sub MoveBall()
If (ballX >= _bouncer.Width) Then
ballMovementX = -ballMovementX
ElseIf (ballX <= 0) Then
ballMovementX = -ballMovementX
End If
If (ballY >= _bouncer.Height) Then
ballMovementY = -ballMovementY
ElseIf (ballY <= 0) Then
ballMovementY = -ballMovementY
End If
ballX += ballMovementX
ballY += ballMovementY
End Sub
End Class
My form displays, but my "ball" doesn't move. What I would like is for the variables and subroutines in my Ball class to control the movement of my Label "ball". Any help, suggestions?