I'm coding the game timer, but am noticing that the gameBall is undeclared and don't see it in the tutorial. Can anyone tell me why?
Private Sub gameTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gameTimer.Tick 'Set the computer player to move according to the ball's position." If gameBall.Location.Y > 5 And gameBall.Location.Y < Me.Height - 40 _ - paddlePlayer.Height Then _ paddleComputer.Location = New Point(paddleComputer.Location.X, gameBall.Location.Y) ' Move the game ball. gameBall.Location = New Point(gameBall.Location.X + xVel, gameBall.Location.Y + yVel) ' Check for top wall. If gameBall.Location.Y < 0 Then gameBall.Location = New Point(gameBall.Location.X, 0) yVel = -yVel End If ' Check for bottom wall. If gameBall.Location.Y > Me.Height - gameBall.Size.Height - 45 Then gameBall.Location = New Point(gameBall.Location.X, Me.Height - gameBall.Size.Height - 45) yVel = -yVel End If ' Check for player paddle. If gameBall.Bounds.IntersectsWith(paddlePlayer.Bounds) Then gameBall.Location = New Point(paddlePlayer.Location.X - gameBall.Size.Width, _ gameBall.Location.Y) xVel = -xVel End If
This post has been edited by macosxnerd101: 22 November 2010 - 10:00 AM
Reason for edit:: Fixed end code tag and moved to VB.NET