If you want the ball to stick to any wall, you can check for wall collision in the code.
Check for whether the ball is colliding with a wall object via a
body_entered signal. When this signal is fired off, use the
body parameter of
body_enteted and the
name attribute of
body to determine whether the object is a wall. Next, assign the position of the collision point to be the current position of the ball, and turn off any other movement code. When you want to move the ball, allow the ball to move again, and reinstate the movement code.