I am making a maze game using Android Studio. I have a GridLayout on the bottom layer of the layout, each cell contains a custom LinearLayout. Some of these LinearLayouts have a special boolean property isWall. If isWall = true I put a different image in the LinearLayout.
The “start” cell of the grid contains a child ImageView of a ball. I want the user to be able to drag the ball through the maze and drop it on any non-wall LinearLayout. I don’t want the ImageView to be dragged across any cell containing a LinearLayout where isWall = true. I know how to get the DragListener to return false after the user drags the ImageView across a “wall” and drops it on the other side, and I basically have the ball return to the cell it was in before that drag.
How to I make the ImageView itself stop mid-drag, thus forcing the user to stay inside the maze walls?