VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



How move picture or object using the timer Como mover um objeto usando timer

by Leonardo Jos¨ (1 Submission)
Category: Games
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 28th September 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

How move picture or object using the timer Como mover um objeto usando timer

API Declarations


Dim lef As Boolean
Dim rig As Boolean

Rate How move picture or object using the timer Como mover um objeto usando timer



lef = False
rig = False
picture1.TabIndex = 0 'important
End Sub
Private Sub PadMover_Timer()
If lef = True Then picture1.Left = picture1.Left - 400 'move left
If rig = True Then picture1.Left = picture1.Left + 400  'move right
End Sub

Private Sub picture1_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft
lef = True

Case vbKeyRight
rig = True

End Select

End Sub

' esse codigo retorna false , quando voçê solta a tecla
' this codigo return false when you  unfasten the key

Private Sub picture1_KeyUp(KeyCode As Integer, Shift As Integer)
Select Case KeyCode

    Case vbKeyLeft
         lef = False

    Case vbKeyRight
         rig = False
         
End Select

End Sub



Download this snippet    Add to My Saved Code

How move picture or object using the timer Como mover um objeto usando timer Comments

No comments have been posted about How move picture or object using the timer Como mover um objeto usando timer. Why not be the first to post a comment about How move picture or object using the timer Como mover um objeto usando timer.

Post your comment

Subject:
Message:
0/1000 characters