I made an attempt to answer your question on your original post, on Stack Overflow:
If you are simply using the array to represent a game grid (so that the player can not be inbetween blocks other than for animation purposes), then it would be extremely efficient to simply check the space the player wants to move to (can only be 4 spaces, up, left, right, or down), see if they are passable terrain, and then allow the player to move there.
This is how I am imagining your board to look, please let me know if this is incorrect:
W W W
O P O
W O W
(A 3 by 3 visualization of the array; W represents a wall, O represents open space, and P represents the player)
for this example I'm going to assume that the top-left corner is represented by locationArray[0][0] and the bottom-right is locationArray[2][2]. X is the first array parameter, Y is the second.
The player is at locationArray[1][1]
In the above case, if the player opted to move left, you would check the array location to his left, locationArray[2][1], find it open, and allow the player to move.
If the player opted to move up, locationArray[1][0], the check would not allow the player to move, as it is impassable terrain (a wall).