如何找到随位置旋转多远?
How to find how far to rotate with position?
假设我的玩家在位置 1,我的敌人在位置 2。假设玩家从零度开始?
x1 = player's X coordinate
y1 = player's Y coordinate
x2 = enemy's X coordinate
y2 = enemy's Y coordinate
angle = math.atan2(y2 - y1, x2 - x1) * 180 / math.pi()
从那里,您可以获得需要转动的角度:)
假设我的玩家在位置 1,我的敌人在位置 2。假设玩家从零度开始?
x1 = player's X coordinate
y1 = player's Y coordinate
x2 = enemy's X coordinate
y2 = enemy's Y coordinate
angle = math.atan2(y2 - y1, x2 - x1) * 180 / math.pi()
从那里,您可以获得需要转动的角度:)