我的代碼有問題,在地精XNA中設計坦克。我的問題是在增強現實中的地面標記上移動坦克。我得到了移動對象的代碼,但是我得到了一個我無法解決的錯誤。我試圖使用幾何節點,移動的代碼是使用對象。如何在Goblin XNA中移動對象?
以下是我的代碼。有人可以幫助我使用此代碼使用幾何節點嗎?
KeyboardState keyboardState = Keyboard.GetState();
if (keyboardState.IsKeyDown(Keys.Right))
{
yourSprite.position.X += 1;
}
if (keyboardState.IsKeyDown(Keys.Left))
{
yourSprite.position.X -= 1;
}
if (keyboardState.IsKeyDown(Keys.Up))
{
yourSprite.position.Y -= 1;
}
if (keyboardState.IsKeyDown(Keys.Down))
{
yourSprite.position.Y += 1;
}
A downloadable version of my program。
你得到什麼錯誤? – Joe
我無法獲得聲明,因爲它的幾何節點錯誤信息是(名稱'yourspirit'在當前上下文中不存在。 – user3346249