Ive just started programming and am not sure why this wont work!!
Is it because i havent declared the variables??
Can someone help please.
Nick
Dim direction As String
Private Sub Command1_Click()
direction = "up"
End Sub
Private Sub Command2_Click()
direction = "down"
End Sub
Private Sub Command3_Click()
direction = "left"
End Sub
Private Sub Command4_Click()
direction = "right"
End Sub
Private Sub Command5_Click()
Menu.Show
Unload Me
End Sub
Private Sub Form_Load()
direction = "still"
End Sub
Private Sub Timer1_Timer()
Select Case direction
Case "up"
Shape2.Top = Shape2.Top - 20
Case "down"
Shape2.Top = Shape2.Top + 20
Case "right"
Shape2.Left = Shape2.Left + 20
Case "left"
Shape2.Left = Shape2.Left - 20
End Select
For i = 0 To 9
If Shape2.Top + Shape2.Height > Shape1(i).Top And Shape2.Top < Shape1(i).Top + Shape(i).Height And Shape2.Left + Shape2.Width > Shape1(i).Left And Shape2.Left < Shape1(i).Left + Shape1(i).Width Then
MsgBox "HIT"
Shape2.Top = 240
Shape2.Left = 120
direction = "still"
End If
If Shape2.Top + Shape2.Height > Shape3.Top And Shape2.Top < Shape3.Top + Shape3.Height And Shape2.Left + Shape2.Width > Shape3.Left And Shape2.Left < Shape3.Left + Shape3.Width Then
MsgBox "Made It"
Shape2.Top = 240
Shape2.Left = 120
direction = "still"
End If
Next i
End Sub