マジックハンドをマウスポインタに向かって動かすには、マウスの座標、ポインタまでの距離、そして移動する方向を決める必要があります。
距離を1回あたりの移動量で割ることで、目的地に到達するまでに必要な移動回数を自動的に算出できます。この回数を基に、戻る動作も実装できます。
To make the magic hand move toward the mouse pointer, we need to determine the mouse coordinates, the distance to the pointer, and the direction of movement.
By dividing the distance by the movement step length, we can automatically calbulate the number of steps required to reach the target. Based ib this number, we can also implement the return movement.