Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Timer1_Timer()
- enemy1.Left = enemy1.Left - 5
- End Sub
- Private Sub Timer1_Timer()
- Do
- enemy1.Left = enemy1.Left - 5
- If enemy1.Left = < 5 Then
- Do
- enemy1.Right = enemy1.Right + 5
- Loop Until enemy1.Right = > 1000 'or whatever your size is
- End If
- Loop
- End Sub
- Option Explicit
- Const nTwipsPerMove = 10
- Private Sub Timer1_Timer()
- Static strDirection As String
- If strDirection = "" Then strDirection = "left"
- If enemy.Left > 0 Then
- If strDirection = "left" Then
- enemy.Left = enemy.Left - nTwipsPerMove
- ElseIf strDirection = "right" Then
- enemy.Left = enemy.Left + nTwipsPerMove
- End If
- End If
- If enemy.Left = 0 Then
- If strDirection = "left" Then strDirection = "right"
- enemy.Left = enemy.Left + nTwipsPerMove
- End If
- If enemy.Left + enemy.Width = Me.Width - nTwipsPerMove * 5 Then
- If strDirection = "right" Then strDirection = "left"
- enemy.Left = enemy.Left - nTwipsPerMove
- End If
- End Sub
Add Comment
Please, Sign In to add comment