我希望能够选择一个随机角度(在 0 到 360 或 0 到 2pi 之间),然后让精灵朝那个方向移动。到目前为止,我已经尝试过这个,但它非常无效,因为它总是向下移动,并且角度选择不是很漂亮。
Random rand = new Random();
//Chooses the Angle
rotation = (float)rand.NextDouble()*MathHelper.TwoPi;
//Is supposed to get a normalized movement vector that moves in the direction of that angle.
moveVector = Vector2.Normalize(new Vector2(-(float)Math.Tan(rotation), 1));