It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

Maze Walls

Moderator: dafunkymunky

Maze Walls

Postby GemmaLouise1988 on Wed Feb 06, 2008 10:30 am

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]
GemmaLouise1988
 
Posts: 0
Joined: Wed Feb 06, 2008 10:26 am

Who is online

Users browsing this forum: No registered users and 3 guests