This is a start:
Global number x0
Global number y0
Global number x1
Global number y1
Start of layout
--- set x0 to Sprite.x
--- set y0 to Sprite.y
Every tick
--- set x1 to Sprite.x
--- set y1 to Sprite.y
--- Sprite: set position to (x0,y0)
--- Sprite: set angle towards (x1, y1)
Repeat distance(x0,y0, x1,y1) times
--- Sprite: move forward 1 pixel
------ Sprite: is overlapping wall
--------- stop loop
--------- Sprite: move forward -1 pixels
Every tick
--- set x0 to sprite.x
--- set y0 to Sprite.y
That will stop the Sprite at walls when being dragged. Having it slide against the walls is more deluxe. There are a few examples around the forum. Not exactly simple but there may be other ways.