Public Enum ModeOfMovement As Integer
Flying = 1
End Enum
'When did we last update a flipped image
Private m_lastTickCountWhenImageFlipped As Integer
Const DTIME_TO_FLAP_WINGS = 400 'Every 600 ms we should
'flap our wings
'–
'These are the current image states for Hank
'–
Private Enum BorisImagesIndexes
flyLeft1 = 1
flyLeft2 = 2
End Enum
'–
'[in] X,Y : Position to start Hank at
'[in] worldHankInhabits : Playfield in which Hank lives
'–
Sub New(ByVal x As Integer, ByVal y As Integer, _
ByVal world_I_Inhabit As PlayFieldManager)
'–
'Get the bitmaps for our character
'–
Dim col As Collection
col = g_FlyingBirdPictureCollection()
m_world_I_Inhabit = world_I_Inhabit
ChangeMyMovementState(ModeOfMovement.Flying)
'Start him off as falling.
'Initialize our base class with these…
MyBase.Initialize_DrawableMultiPlayfiedBitmapObject( _
x, y, col, True)
'Set the image index
Me.CurrentFrameIndex = BorisImagesIndexes.flyLeft1
'Set Boris' speed
m_xVelocityBoris = -4
m_y_accelerationBorris = 1
'–
'Set the collision rectangle for Hank
'–
Const BORIS_COLLISION_STARTX = 11
Const BORIS_COLLISION_DX = 31
Const BORIS_COLLISION_STARTY = 6
Const BORIS_COLLISION_DY = 7
Me.CollisionRectangle = New Rectangle( _
BORIS_COLLISION_STARTX, BORIS_COLLISION_STARTY, _
BORIS_COLLISION_DX, BORIS_COLLISION_DY)
End Sub
'–
'This function should be called to bring about any change
'of state
'It sets/resets any other variables we need to when we deal
'with state transitions
'–
Private Sub ChangeMyMovementState(ByVal newState As _
ModeOfMovement)
m_myModeOfMovement = newState
End Sub
'–
'MOVE Boris
'
'This function is called to move the character on the screen
Конец ознакомительного фрагмента.
Текст предоставлен ООО «ЛитРес».
Прочитайте эту книгу целиком, купив полную легальную версию на ЛитРес.
Безопасно оплатить книгу можно банковской картой Visa, MasterCard, Maestro, со счета мобильного телефона, с платежного терминала, в салоне МТС или Связной, через PayPal, WebMoney, Яндекс.Деньги, QIWI Кошелек, бонусными картами или другим удобным Вам способом.