Guest User

Untitled

a guest
Jun 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2. Dim X As Integer, Y As Integer, H As Integer, V As Integer
  3.  
  4. Private Declare Function ShowCursor Lib "user32" _
  5.     (ByVal bShow As Long) As Long
  6. Dim blnshow As Boolean
  7. Private Sub Form_Load()
  8.     blnshow = True
  9.     X = 200   'horizontal speed
  10.    Y = 200   'vertical speed
  11.    H = 200
  12.     V = 200
  13.     blnshow = Not blnshow
  14.     ShowCursor blnshow
  15. End Sub
  16.  
  17. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  18. Static count As Integer         'code to make program close
  19.  If count > 2 Then
  20.     If Not blnshow Then
  21.         ShowCursor True
  22.     End If
  23.     End  'closes the program
  24.  Else
  25.     count = count + 1
  26.   End If
  27. End Sub
  28.  
  29. Private Sub Timer1_Timer()
  30.     ball.Move ball.Left + X, ball.Top + Y       'code to make the ball move
  31.    
  32.     If ball.Top + ball.Height > Me.ScaleHeight Then     'if ball hits bottom
  33.        Randomize
  34.         Y = Rnd * -1500                                       'make ball go up
  35.    End If
  36.    
  37.     If ball.Left + ball.Width > Me.ScaleWidth Then      'if ball hits right
  38.        Randomize
  39.         X = Rnd * -1500                                         'make ball go left
  40.    End If
  41.    
  42.     If ball.Top < 0 Then        'if ball hits top
  43.        Randomize
  44.         Y = Rnd * 1500                  'make ball go down
  45.    End If
  46.    
  47.     If ball.Left < 0 Then       'if ball hits left
  48.        Randomize
  49.         X = Rnd * 1500                  'go right
  50.    End If
  51. End Sub
Add Comment
Please, Sign In to add comment