Option Explicit
' 38 Up
' 40 Down
' 37 Left
' 39 Right
Private Sub Form_Load()
tmrEnemyLeft.Enabled = True
tmrEnemyRight.Enabled = False
blnShit = True
lblCrash.Visible = False
myScore = 0
txtScore.Text = myScore
End Sub
Private Sub picCig_KeyDown(KeyCode As Integer, Shift As Integer)
picCig.SetFocus
If KeyCode = 38 Then
picCig.Top = picCig.Top - 2
If picCig.Top = 42 Then
lblCrash.Visible = True
txtScore.Text = txtScore.Text + myScore + 50
End If
End If
If KeyCode = 40 Then picCig.Top = picCig.Top + 2
If KeyCode = 37 Then picCig.Left = picCig.Left - 2
If KeyCode = 39 Then picCig.Left = picCig.Left + 2
End Sub
Private Sub tmrEnemyLeft_Timer()
If blnShit = True Then
picEnemy.Left = picEnemy.Left - 2 ' Move 2px Left til End
End If
If picEnemy.Left = 0 Then
tmrEnemyLeft.Enabled = False
tmrEnemyLeft.Interval = 0
blnShit = False
tmrEnemyRight.Enabled = True
End If
txtDebug.Text = txtDebug.Text & "Enemy Position = " & picEnemy.Left & vbCrLf
End Sub
Private Sub tmrEnemyRight_Timer()
If blnShit = False Then
picEnemy.Left = picEnemy.Enabled + 2 ' Move 2px Right til End
End If
If picEnemy.Left = 264 Then
tmrEnemyLeft.Enabled = True
blnShit = True
tmrEnemyRight.Enabled = False
End If
txtDebug.Text = txtDebug.Text & "Enemy Position = " & picEnemy.Left & vbCrLf
End Sub