You've got the loop wrong... as you will keep setting dirCollision.Left for each wall, so it will only store the last value.
Here is one way you could fix it:
Code:If (KeyCode = vbKeyLeft) Then dirCollision.Left = False For i = 0 To sprWall.Count - 1 If sprPlayer.TestCollision(sprPlayer.Left - PlayerSpeed, sprPlayer.Top, sprPlayer.Width, sprPlayer.Height, sprWall(i).Left, sprWall(i).Top, sprWall(i).Width, sprWall(i).Height) Then dirCollision.Left = True Exit For End If Next i




Reply With Quote