Mah....io uso un codice un pò più sempliciotto, sono ancora alle prime armi con Xna, comunque ti allego un codice che potrebbe darti qualche idea.
codice:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace WindowsGame1
{
public class Game1 : Microsoft.Xna.Framework.Game
{
private GraphicsDeviceManager g;
private SpriteBatch s;
private Vector2 Pos;
private Texture2D sprite;
public void KeybInput()
{
KeyboardState k = Keyboard.GetState();
if (k.IsKeyDown(Keys.Escape))
{
this.Exit();
}
else if (k.IsKeyDown(Keys.Right))
Pos += new Vector2(1, 0);
else if (k.IsKeyDown(Keys.Left))
Pos += new Vector2(-1, 0);
else if (k.IsKeyDown(Keys.Up))
Pos += new Vector2(0, -1);
else if (k.IsKeyDown(Keys.Down))
Pos += new Vector2(0, 1);
}
public Game1()
{
g = new GraphicsDeviceManager(this);
g.PreferredBackBufferWidth = 1000;
g.PreferredBackBufferHeight = 500;
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
Pos=new Vector2(400, 200);
base.Initialize();
}
protected override void LoadContent()
{
s = new SpriteBatch(GraphicsDevice);
sprite = Content.Load<Texture2D>("x");
}
protected override void UnloadContent()
{
}
protected override void Update(GameTime t)
{
KeybInput();
base.Update(t);
}
protected override void Draw(GameTime t)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
s.Begin();
s.Draw(sprite, Pos, Color.White);
s.End();
}
}
}