我正在做一个Tic-Tac-Toe游戏.我需要检查玩家是否点击了他们已经点击过的广场.
问题是错误显示在第一次单击本身.我的更新代码是:
MouseState mouse = Mouse.GetState();
int x, y;
int go = 0;
if (mouse.LeftButton == ButtonState.Pressed)
{
showerror = 0;
gamestate = 1;
x = mouse.X;
y = mouse.Y;
int getx = x / squaresize;
int gety = y / squaresize;
for (int i = 0; i < 3; i++)
{
if (go == 1)
{
break;
}
for (int j = 0; j < 3; j++)
{
if (getx == i && gety == j)
{
if (storex[i, …Run Code Online (Sandbox Code Playgroud)