Scratchではatanしかないので、yがマイナスになると、角度の計算がおかしくなる。今回は条件を反転させる処理を入れていますが、他の言語ではatan2があるので、そちらを使ってyがマイナスになる状況でも対応できます。
atanは座標がわかれば、角度がわかるという便利な関数ですね。
Scratch only provides the atan function, so when the y-value is negative, the angle calculation becomes incorrect .In this implementation, we handle this by adding a conditional adjustment.In other programming languages, however, there is a function called atan2, which can correctly calculate angles even when y is negative.
The atan function is useful because it allows us to calculate an angle when the coordinates are known.
次回

