I have the following code in a default Monogame Game project:
protected override void Update(GameTime gameTime)
{
if (Keyboard.GetState().IsKeyDown(Keys.Left))
{
paddle.Box.Offset(-10, 0);
Debug.WriteLine(paddle.Box);
}
if (Keyboard.GetState().IsKeyDown(Keys.Right))
{
paddle.Box.Offset(10, 0);
Debug.WriteLine(paddle.Box);
}
base.Update(gameTime);
}
paddle.Box
is a normal XNA Rectangle.
The problem is that the location of paddle.Box
does not change after calling any of the Offset()
overloads, as debugging confirms. If I just assign a new Rectangle, it works, but Offset
(and Inflate()
, FWIW) seems to be broken.
What am I doing wrong?