queechi
12-21-2001, 09:22 AM
I'm new to vb and whenever I press the space key the bomb won't move the 80 twips down but instead shoots to the left of the screen and stays there:
Private Sub bombdown_Timer()
bomb.Move bomb.Top + 80
If bomb.Top = bin.Top Then
binleft.Enabled = False
binright.Enabled = False
bin.Visible = False
bin2.Visible = False
boom.Visible = True
bombdown.Enabled = False
End If
If bomb.Top > 5000 Then
bomb.Top = 120
bombdown.Enabled = False
binleft.Enabled = True
binright.Enabled = True
End If
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyLeft Then
bomb.Move bomb.Left - 500
If bomb.Left < 0 Then
bomb.Left = 8000
End If
ElseIf KeyCode = vbKeyRight Then
bomb.Move bomb.Left + 500
If bomb.Left > 7080 Then
bomb.Left = 100
End If
ElseIf KeyCode = vbKeySpace Then
bombdown.Enabled = True
End If
End Sub
Private Sub binright_Timer()
bin.Move bin.Left + 120
bin2.Move bin2.Left + 120
boom.Move boom.Left + 120
If bin.Left = 7080 Then
bin.Visible = False
bin2.Visible = True
binright.Enabled = False
binleft.Enabled = True
End If
End Sub
Private Sub binleft_Timer()
bin.Move bin.Left - 120
bin2.Move bin2.Left - 120
boom.Move boom.Left - 120
If bin.Left < 10 Then
bin.Visible = True
bin2.Visible = False
binright.Enabled = True
binleft.Enabled = False
End If
End Sub
Private Sub bombdown_Timer()
bomb.Move bomb.Top + 80
If bomb.Top = bin.Top Then
binleft.Enabled = False
binright.Enabled = False
bin.Visible = False
bin2.Visible = False
boom.Visible = True
bombdown.Enabled = False
End If
If bomb.Top > 5000 Then
bomb.Top = 120
bombdown.Enabled = False
binleft.Enabled = True
binright.Enabled = True
End If
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyLeft Then
bomb.Move bomb.Left - 500
If bomb.Left < 0 Then
bomb.Left = 8000
End If
ElseIf KeyCode = vbKeyRight Then
bomb.Move bomb.Left + 500
If bomb.Left > 7080 Then
bomb.Left = 100
End If
ElseIf KeyCode = vbKeySpace Then
bombdown.Enabled = True
End If
End Sub
Private Sub binright_Timer()
bin.Move bin.Left + 120
bin2.Move bin2.Left + 120
boom.Move boom.Left + 120
If bin.Left = 7080 Then
bin.Visible = False
bin2.Visible = True
binright.Enabled = False
binleft.Enabled = True
End If
End Sub
Private Sub binleft_Timer()
bin.Move bin.Left - 120
bin2.Move bin2.Left - 120
boom.Move boom.Left - 120
If bin.Left < 10 Then
bin.Visible = True
bin2.Visible = False
binright.Enabled = True
binleft.Enabled = False
End If
End Sub