【发布时间】:2013-06-09 12:31:49
【问题描述】:
我在 xna 2D sprite 中做了一个简单的测试,并尝试用鼠标移动它,它可以工作,但是如果我移动它有点快,sprite 会在途中丢失,我按住左键,当我回来时对精灵继续拖动...
我想知道为什么如果我移动得快一点我会失去我的精灵???
这是我的移动逻辑:
MouseState ms = Mouse.GetState();
if ((ButtonState.Pressed == Mouse.GetState().LeftButton) && myBall.RectObject.Intersects(new Rectangle(ms.X, ms.Y, 0, 0)))
{
myBall.RectObject = new Rectangle(ms.X - myBall.RectObject.Width / 2, ms.Y - myBall.RectObject.Height / 2, myBall.RectObject.Width, myBall.RectObject.Height);
}
【问题讨论】: