19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Public Function X() As Integer<br />

X = m_imgPlane.Left<br />

End Function<br />

Public Function Y() As Integer<br />

Y = m_imgPlane.Top<br />

End Function<br />

Public Function W() As Integer<br />

W = m_imgPlane.Width<br />

End Function<br />

Public Function H() As Integer<br />

H = m_imgPlane.Height<br />

End Function<br />

Public Sub Fly(ByVal dir As String, ByVal Height As Integer, ByVal Width As<br />

Integer)<br />

m_imgPlane.Visible = True<br />

‘Meanings of variables<br />

‘dir Direction of airplane (Right, Up, or Down)<br />

‘Height Height of form<br />

‘Width Width of form<br />

If dir = “Up” Then<br />

‘Prevent airplane from rising off the screen.<br />

If (m_imgPlane.Top - 500)>= 0 Then<br />

m_imgPlane.Top = m_imgPlane.Top - 500<br />

End If<br />

ElseIf dir = “Down” Then<br />

‘Prevent airplane from falling off the screen.<br />

If (m_imgPlane.Top + m_imgPlane.Height + 500)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!