CODE
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyRight Then
If shpball.Left + shpball.Width <= frmmaze.ScaleWidth Then
'do nothing
Else
shpball.Left = shpball.Left - 100
End If
If shpball.Left + shpball.Width > lne1.X1 And _
shpball.Top < lne1.Y2 And _
shpball.Top + shpball.Height > lne1.Y1 Then
'do nothing
Else
shpball.Left = shpball.Left + 100
End If
End If
If KeyCode = vbKeyLeft Then
If shpball.Left + shpball.Left <= frmmaze.ScaleLeft Then
'do nothing
Else
shpball.Left = shpball.Left - 100
End If
End If
If KeyCode = vbKeyUp Then
If shpball.Top + shpball.Top <= frmmaze.ScaleTop Then
'do nothing
Else
shpball.Top = shpball.Top - 100
End If
End If
If KeyCode = vbKeyDown Then
If shpball.Top + shpball.Height >= frmmaze.ScaleHeight Then
'do nothing
Else
shpball.Top = shpball.Top + 100
End If
End If
End Sub
this is my code which is similar to yours.....
my ball wont move throught the wall when the right key id pressed
the problem is that when i go round the wall it will go back through the wall when i press left. also when im on the right hand side of the line it wont let me move right when the ball is in line with the line itself, why is this?
EDIT: Please use code tags in the future when posting code, it make it much easier for the reader to read the code, use them like so =>

PsychoCoder
This post has been edited by PsychoCoder: 24 Jan, 2008 - 06:05 AM