i am trying to create a maze, and i want to stop my picture going through the walls, i have go it to not go through on the walls on three of them but not on the down one, can anyone see whats wrong?
- Code: Select all
Private Sub Form_Keydown(Keycode As Integer, Shift As Integer)
If Keycode = vbKeyRight Then
If Shape1.Left + Shape1.Width >= Game.ScaleWidth Or _
Shape1.Left + Shape1.Width = Wall1.X1 And _
Shape1.Top < Wall1.Y2 And _
Shape1.Top + Shape1.Height > Wall1.Y1 Then
Else
Shape1.Left = Shape1.Left + 100
End If
End If
If Keycode = vbKeyLeft Then
If Shape1.Left >= Game.ScaleWidth Or _
Shape1.Left = Wall1.X1 And _
Shape1.Top < Wall1.Y2 And _
Shape1.Top + Shape1.Height > Wall1.Y1 Then
Else
Shape1.Left = Shape1.Left - 100
End If
End If
If Keycode = vbKeyDown Then
If Shape1.Top <= Game.ScaleTop Or _
Shape1.Top = Wall1.Y2 And _
Shape1.Left < Wall1.X1 And _
Shape1.Left + Shape1.Width > Wall1.X1 Then
Else
Shape1.Top = Shape1.Top + 100
End If
End If
If Keycode = vbKeyUp Then
If Shape1.Top <= Game.ScaleTop Or _
Shape1.Top = Wall1.Y2 And _
Shape1.Left < Wall1.X1 And _
Shape1.Left + Shape1.Width > Wall1.X1 Then
Else
Shape1.Top = Shape1.Top - 100
End If
End If
End Sub

[/code]