View Single Post
  #1 (permalink)  
Old May 1st, 2008, 09:48 AM
humera humera is offline
Registered User
 
Join Date: Apr 2008
Location: karachi, pakistan, Pakistan.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default can any one tell me how i can add ball in run time

in runtime how i m add ball one by one i have 3 ball i want one ball 1st time 2nd ball after 5 min come and 3rd after 7 min come how i can this in code i use a timer plz help me
Dim X As Integer, Y As Integer
Dim c As Boolean

Private Sub Form_Load()
ball.Top = 2500
ball.Left = 1300
X = -50
Y = -50
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
pad0.Left = X - pad0.Width
End Sub

Private Sub Timer4_Timer()
ball.Move ball.Left + X, ball.Top + Y
If ball.Top <= 0 Then
    Y = Y * -1
End If

If ball.Left <= 0 Then
    X = X * -1
End If
If ball.Left + ball.Width >= Me.ScaleWidth Then
    X = X * -1
End If
If ball.Top + ball.Height >= pad.Top Then
If (ball.Left + ball.Width < pad.Left) Or (ball.Left > pad.Left + pad.Width) Then 'If the ball is to the left or right of the pad then
ball = ball + 1
Me.Caption = "Game Over" 'set the forms caption to read 'Game Over'
MsgBox "Game over back to menu home !!! ", vbDefaultButton1
Timer4.Enabled = False 'pause the program
Else
Y = Y * -1.05 'speed up the ball
X = X * 1.05
Score = Score + 1 'add 1 more hit to the score
scorecard.Caption = "Score: " & Score 'show the score on our label
'Me.Caption = "Score: " & Score 'show the score as our forms caption
If (ball.Left + ball.Width) < (pad.Left + pad.Width) Then 'if the ball is to the left of the pads centre then
If X > 0 Then 'if it is going right
X = X * -1 'make it go left
End If
Else 'the ball must be on the right of the pad
If X < 0 Then 'if it is going left
X = X * -1 'make it go right
End If
End If
End If
End If
End Sub


Reply With Quote