Option Explicit
'pong balls
Dim BallX(10) As Single
Dim BallY(10) As Single
Dim DirEx(10) As Integer
Dim DirWi(10) As Integer
Dim DistanceX As Integer
Dim DistanceY As Integer
Dim resettime As Long
'environment and edges of the game
Dim intLong As Integer
Dim intBegin As Integer
Dim Lside As Integer
Dim Rside As Integer
Dim Tside As Integer
Dim Dside As Integer
Dim intcount As Integer
Dim Score As Integer
Dim MouseaxisY As Single
Private Sub cmdSpeed_Click()
If Val(txtBall.Text) > 13 Then
Let intLong = 12
Let txtBall.Text = 12
ElseIf Val(txtBall.Text) < 1 Then
Let intLong = 12
Let txtBall.Text = 12
End If
Let intBegin = Val(txtBall.Text) / 2
Let intLong = Val(txtBall.Text)
End Sub
Private Sub Form_Load()
Print Picture1.ScaleWidth
For intcount = 0 To 10
Let DirEx(intcount) = 1
Let DirWi(intcount) = 1
Let BallX(intcount) = Picture1.ScaleWidth / 2
Let BallY(intcount) = Picture1.ScaleHeight / 2
Let intBegin = 5
Let intLong = 12
Let Score = 0
Next intcount
Let Lside = 0
Let Rside = Picture1.ScaleWidth
Let Tside = 0
Let Dside = Picture1.ScaleHeight
Let DistanceX = 16
Let DistanceY = 16
Let intBegin = 4
Let intLong = 10
Let BallX(0) = Picture1.ScaleWidth / 2
Let BallY(0) = Picture1.ScaleHeight / 2
End Sub
Private Sub mnu_file_exit_Click()
Unload Me
End Sub
Private Sub mnu_file_start_Click()
Timer.Enabled = Not Timer.Enabled
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Let MouseaxisY = Y
End Sub
Private Sub Timer_Timer()
Let Paddle.Y1 = MouseaxisY
Let Paddle.Y2 = MouseaxisY + 50
Let Paddle1.Y1 = MouseaxisY
Let Paddle1.Y2 = MouseaxisY + 50
Picture1.Refresh
Let Label.Caption = Str(BallX(0)) & "," & Str(BallY(0))
For intcount = 0 To 0
Randomize
Picture1.DrawWidth = 10
Picture1.ForeColor = RGB(Int(Rnd * Int(Rnd * 125)) + 175, Int(Rnd * 50), Int(Rnd * 50))
Picture1.Line (BallX(intcount), BallY(intcount))-Step(1, 1)
Let BallX(intcount) = BallX(intcount) + DirEx(intcount) * DistanceX
Let BallY(intcount) = BallY(intcount) + DirWi(intcount) * DistanceY
If BallX(intcount) >= Rside Then
Let DirEx(intcount) = -1
Let DistanceX = Int(Rnd * intLong) + intBegin
Let DistanceY = Int(Rnd * intLong) + intBegin
ElseIf BallX(intcount) <= Lside Then
Let Score = Score + Val(txtBall.Text)
Let TxtScore = Score
Let TxtScore.Text = "Score: " & Score
Let DirEx(intcount) = 1
Let DistanceX = Int(Rnd * intLong) + intBegin
Let DistanceY = Int(Rnd * intLong) + intBegin
End If
'If the ball hits left or right side, this is where the ball hits the paddle
'if it hits, you get one point, if you miss it gets reset to 0 and
'you can play the game again
If BallX(intcount) < Lside + 10 Then
If BallY(0) >= Paddle.Y1 And BallY(0) <= Paddle.Y2 Then
'if x > 3 and x < 7 then
Let Score = Score + Val(txtBall.Text)
Let TxtScore = Score
Let TxtScore.Text = "Score: " & Score
Let DirEx(intcount) = 1
Let DistanceX = Int(Rnd * intLong) + intBegin
Let DistanceY = Int(Rnd * intLong) + intBegin
End If
End If
If BallX(intcount) < Lside Then
If BallY(0) >= Paddle.Y1 And BallY(0) <= Paddle.Y2 Then
Let DirEx(intcount) = 1
Let DistanceX = Int(Rnd * intLong) + intBegin
Let DistanceY = Int(Rnd * intLong) + intBegin
Else
For resettime = 0 To 5000000
Next resettime
Let Score = 0
Let TxtScore = "Score: 0"
Let DirEx(intcount) = Int(Rnd * 3) - 1
Let DirWi(intcount) = 1
Let BallX(intcount) = Picture1.ScaleWidth / 2
Let BallY(intcount) = Picture1.ScaleHeight / 2
Let DirEx(intcount) = 1
End If
End If
' If BallX(intcount) < Rside + 10 Then
' If BallY(0) >= Paddle1.Y1 And BallY(0) <= Paddle1.Y2 Then
' 'if x > 3 and x < 7 then
' Let Score = Score + Val(txtBall.Text)
' Let TxtScore = Score
' Let TxtScore.Text = "Score: " & Score
' Let DirEx(intcount) = 1
' Let DistanceX = Int(Rnd * intLong) + intBegin
' Let DistanceY = Int(Rnd * intLong) + intBegin
' End If
' End If
'
' If BallX(intcount) < Rside Then
' If BallY(0) >= Paddle1.Y1 And BallY(0) <= Paddle1.Y2 Then
' Let DirEx(intcount) = 1
' Let DistanceX = Int(Rnd * intLong) + intBegin
' Let DistanceY = Int(Rnd * intLong) + intBegin
' Else
' For resettime = 0 To 5000000
' Next resettime
' Let Score = 0
' Let TxtScore = "Score: 0"
' Let DirEx(intcount) = Int(Rnd * 3) - 1
' Let DirWi(intcount) = 1
' Let BallX(intcount) = Picture1.ScaleWidth / 2
' Let BallY(intcount) = Picture1.ScaleHeight / 2
' Let DirEx(intcount) = 1
' End If
' End If
If BallY(intcount) > Dside Then
Let DirWi(intcount) = -1
Let DistanceX = Int(Rnd * intLong) + intBegin
Let DistanceY = Int(Rnd * intLong) + intBegin
Let intBegin = intBegin + 5
ElseIf BallY(intcount) > Rside Then
Let DirWi(intcount) = 1
Let DistanceX = Int(Rnd * intLong) + intBegin
Let DistanceY = Int(Rnd * intLong) + intBegin
Let intBegin = intBegin + 5
ElseIf BallY(intcount) < Tside Then
Let DirWi(intcount) = 1
Let DistanceX = Int(Rnd * 20) + intBegin
Let DistanceY = Int(Rnd * 20) + intBegin
Let intBegin = intBegin - 10
End If
Next intcount
End Sub
Please, someone help me...
'pong balls
Dim BallX(10) As Single
Dim BallY(10) As Single
Dim DirEx(10) As Integer
Dim DirWi(10) As Integer
Dim DistanceX As Integer
Dim DistanceY As Integer
Dim resettime As Long
'environment and edges of the game
Dim intLong As Integer
Dim intBegin As Integer
Dim Lside As Integer
Dim Rside As Integer
Dim Tside As Integer
Dim Dside As Integer
Dim intcount As Integer
Dim Score As Integer
Dim MouseaxisY As Single
Private Sub cmdSpeed_Click()
If Val(txtBall.Text) > 13 Then
Let intLong = 12
Let txtBall.Text = 12
ElseIf Val(txtBall.Text) < 1 Then
Let intLong = 12
Let txtBall.Text = 12
End If
Let intBegin = Val(txtBall.Text) / 2
Let intLong = Val(txtBall.Text)
End Sub
Private Sub Form_Load()
Print Picture1.ScaleWidth
For intcount = 0 To 10
Let DirEx(intcount) = 1
Let DirWi(intcount) = 1
Let BallX(intcount) = Picture1.ScaleWidth / 2
Let BallY(intcount) = Picture1.ScaleHeight / 2
Let intBegin = 5
Let intLong = 12
Let Score = 0
Next intcount
Let Lside = 0
Let Rside = Picture1.ScaleWidth
Let Tside = 0
Let Dside = Picture1.ScaleHeight
Let DistanceX = 16
Let DistanceY = 16
Let intBegin = 4
Let intLong = 10
Let BallX(0) = Picture1.ScaleWidth / 2
Let BallY(0) = Picture1.ScaleHeight / 2
End Sub
Private Sub mnu_file_exit_Click()
Unload Me
End Sub
Private Sub mnu_file_start_Click()
Timer.Enabled = Not Timer.Enabled
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Let MouseaxisY = Y
End Sub
Private Sub Timer_Timer()
Let Paddle.Y1 = MouseaxisY
Let Paddle.Y2 = MouseaxisY + 50
Let Paddle1.Y1 = MouseaxisY
Let Paddle1.Y2 = MouseaxisY + 50
Picture1.Refresh
Let Label.Caption = Str(BallX(0)) & "," & Str(BallY(0))
For intcount = 0 To 0
Randomize
Picture1.DrawWidth = 10
Picture1.ForeColor = RGB(Int(Rnd * Int(Rnd * 125)) + 175, Int(Rnd * 50), Int(Rnd * 50))
Picture1.Line (BallX(intcount), BallY(intcount))-Step(1, 1)
Let BallX(intcount) = BallX(intcount) + DirEx(intcount) * DistanceX
Let BallY(intcount) = BallY(intcount) + DirWi(intcount) * DistanceY
If BallX(intcount) >= Rside Then
Let DirEx(intcount) = -1
Let DistanceX = Int(Rnd * intLong) + intBegin
Let DistanceY = Int(Rnd * intLong) + intBegin
ElseIf BallX(intcount) <= Lside Then
Let Score = Score + Val(txtBall.Text)
Let TxtScore = Score
Let TxtScore.Text = "Score: " & Score
Let DirEx(intcount) = 1
Let DistanceX = Int(Rnd * intLong) + intBegin
Let DistanceY = Int(Rnd * intLong) + intBegin
End If
'If the ball hits left or right side, this is where the ball hits the paddle
'if it hits, you get one point, if you miss it gets reset to 0 and
'you can play the game again
If BallX(intcount) < Lside + 10 Then
If BallY(0) >= Paddle.Y1 And BallY(0) <= Paddle.Y2 Then
'if x > 3 and x < 7 then
Let Score = Score + Val(txtBall.Text)
Let TxtScore = Score
Let TxtScore.Text = "Score: " & Score
Let DirEx(intcount) = 1
Let DistanceX = Int(Rnd * intLong) + intBegin
Let DistanceY = Int(Rnd * intLong) + intBegin
End If
End If
If BallX(intcount) < Lside Then
If BallY(0) >= Paddle.Y1 And BallY(0) <= Paddle.Y2 Then
Let DirEx(intcount) = 1
Let DistanceX = Int(Rnd * intLong) + intBegin
Let DistanceY = Int(Rnd * intLong) + intBegin
Else
For resettime = 0 To 5000000
Next resettime
Let Score = 0
Let TxtScore = "Score: 0"
Let DirEx(intcount) = Int(Rnd * 3) - 1
Let DirWi(intcount) = 1
Let BallX(intcount) = Picture1.ScaleWidth / 2
Let BallY(intcount) = Picture1.ScaleHeight / 2
Let DirEx(intcount) = 1
End If
End If
' If BallX(intcount) < Rside + 10 Then
' If BallY(0) >= Paddle1.Y1 And BallY(0) <= Paddle1.Y2 Then
' 'if x > 3 and x < 7 then
' Let Score = Score + Val(txtBall.Text)
' Let TxtScore = Score
' Let TxtScore.Text = "Score: " & Score
' Let DirEx(intcount) = 1
' Let DistanceX = Int(Rnd * intLong) + intBegin
' Let DistanceY = Int(Rnd * intLong) + intBegin
' End If
' End If
'
' If BallX(intcount) < Rside Then
' If BallY(0) >= Paddle1.Y1 And BallY(0) <= Paddle1.Y2 Then
' Let DirEx(intcount) = 1
' Let DistanceX = Int(Rnd * intLong) + intBegin
' Let DistanceY = Int(Rnd * intLong) + intBegin
' Else
' For resettime = 0 To 5000000
' Next resettime
' Let Score = 0
' Let TxtScore = "Score: 0"
' Let DirEx(intcount) = Int(Rnd * 3) - 1
' Let DirWi(intcount) = 1
' Let BallX(intcount) = Picture1.ScaleWidth / 2
' Let BallY(intcount) = Picture1.ScaleHeight / 2
' Let DirEx(intcount) = 1
' End If
' End If
If BallY(intcount) > Dside Then
Let DirWi(intcount) = -1
Let DistanceX = Int(Rnd * intLong) + intBegin
Let DistanceY = Int(Rnd * intLong) + intBegin
Let intBegin = intBegin + 5
ElseIf BallY(intcount) > Rside Then
Let DirWi(intcount) = 1
Let DistanceX = Int(Rnd * intLong) + intBegin
Let DistanceY = Int(Rnd * intLong) + intBegin
Let intBegin = intBegin + 5
ElseIf BallY(intcount) < Tside Then
Let DirWi(intcount) = 1
Let DistanceX = Int(Rnd * 20) + intBegin
Let DistanceY = Int(Rnd * 20) + intBegin
Let intBegin = intBegin - 10
End If
Next intcount
End Sub
Please, someone help me...