home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH13 / 13-3-1B.CLS < prev    next >
Encoding:
Visual Basic class definition  |  1998-09-18  |  987 b   |  39 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "CBomb"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = False
  10. Private imgBomb As Image
  11. Public Event BombPositionChanged(X As Integer, Y As Integer, W As Integer, H As Integer)
  12.  
  13. Property Let imageBomb(bomb As Image)
  14.   Set imgBomb = bomb
  15. End Property
  16.  
  17. Public Sub GoDown(plane As CPlane, ByVal FormHeight As Integer)
  18.   Dim j As Integer
  19.   imgBomb.Left = plane.X + 0.5 * plane.W
  20.   imgBomb.Top = plane.Y + plane.H
  21.   imgBomb.Visible = True
  22.   Do While imgBomb.Top < FormHeight
  23.     imgBomb.Top = imgBomb.Top + 5
  24.     RaiseEvent BombPositionChanged(imgBomb.Left, imgBomb.Top, imgBomb.Width, imgBomb.Height)
  25.     'Pause
  26.     For j = 1 To 2000
  27.     Next j
  28.   Loop
  29.   'imgBomb.Visible = False
  30. End Sub
  31.  
  32. Public Sub Destroy()
  33.   imgBomb.Visible = False
  34. End Sub
  35.  
  36. Private Sub Class_Terminate()
  37.   Set imgBomb = Nothing
  38. End Sub
  39.