精灵方向移动 [英] Sprite Direction Moving
本文介绍了精灵方向移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将精灵沿其旋转方向移动.
I want to move the sprite in the direction it''s rotated.
if (newState.IsKeyDown(Keys.W))
{
airplanePos += new Vector2(Convert.ToInt32(Math.Sin(airplaneAngle * 360)), Convert.ToInt32(Math.Cos(airplaneAngle * 360)));
}
推荐答案
我相信应该是这样的,尽管我还没有测试过:
I BELIEVE it should be like this, although I haven''t tested it:
if (newState.IsKeyDown(Keys.W))
{
airplanePos += new Vector2(Convert.ToInt32(Math.Cos(airplaneAngle * 360)), Convert.ToInt32(Math.Sin(airplaneAngle * 360)));
}
这篇关于精灵方向移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文