トピック
受付中
Martine X22D64

sprite direction with the circle pad

This is the math to find the direction a sprite goes depending on the angle. xx=cos(angle*pi()/180) yy=sin(angle*pi()/180) What I need to know is how to find the angle depending on the direction(the complete opposite). I'v tried flipping the formula around with no luck. Can anybody help?
2そうだね
プレイ済み
返信[1]
親投稿
Hanzo rzsense
You can get angle with the following formula. angle=ATAN(yy,xx)
1そうだね
未プレイ
返信[2]
親投稿
Hanzo rzsense
In my previous post, the angle is given in radian. If you want to get angle in degree, you can transform it with the following methods. degree=180*radian/PI() or degree=DEG(radian)
2そうだね
未プレイ
返信[3]
親投稿
Martine X22D64
Thanks.
0そうだね
プレイ済み
返信[4]
親投稿
Oscar PwnageBlock
As Hanzo said, you can find the angle (in degrees) with DEG(ATAN(y,x)). However, be mindful that values range from -180 to 180 degrees. In case you want the values to range from 0 to 360 degrees, you can easily set a conditional like this... STICK OUT X,Y ANG=DEG(ATAN(Y,X)) IF ANG<0 THEN INC ANG,360 ENDIF
1そうだね
プレイ済み