Distance formula: d² = (x₂ - x₁)² + (y₂ - y₁)² Get the distance by subtracting the 1st X position from the 2nd X position and same for the Y values. Square the two results, add them together, and get the square root of it. Move the purple block by dragging and dropping. Like in the previous prototype, it will automatically snap to the grid. If you try to move it into a solid wall, it will glide at the same speed to its last recorded (x,y) position with the help of the distance formula.
Yes, I’ve been schooled. And you be learned will too. ;)