C++ 编程C++;和DirectX

C++ 编程C++;和DirectX,c++,directx-10,C++,Directx 10,我有个问题。。。我在M.V.C++2010 Express和DirectX中工作。 我必须让目标在正方形内移动。但是当绘制我的变量(x,y)正在重置的点时 if(y2==100) x2=x2+1; if(x2==700) y2=y2+1; if(y2==500) x2=x2-1; if((x2=100)&&(y2==500)) y2=y2-1; //here, when to write the first pixel, my x is reset

我有个问题。。。我在M.V.C++2010 Express和DirectX中工作。 我必须让目标在正方形内移动。但是当绘制我的变量(x,y)正在重置的点时

if(y2==100)
    x2=x2+1;
if(x2==700)
    y2=y2+1;
if(y2==500)
    x2=x2-1;
if((x2=100)&&(y2==500))
    y2=y2-1;
//here, when to write the first pixel, my x is reseting to 100(default).
gfx.PutPixel(x2,y2,255,255,255);
gfx.PutPixel(x2-5,y2,255,255,255);
gfx.PutPixel(x2-4,y2,255,255,255);
gfx.PutPixel(x2-3,y2,255,255,255);
gfx.PutPixel(x2+3,y2,255,255,255);
gfx.PutPixel(x2+4,y2,255,255,255);
gfx.PutPixel(x2+5,y2,255,255,255);
gfx.PutPixel(x2,y2-5,255,255,255);
gfx.PutPixel(x2,y2-4,255,255,255);
gfx.PutPixel(x2,y2-3,255,255,255);
gfx.PutPixel(x2,y2+3,255,255,255);
gfx.PutPixel(x2,y2+4,255,255,255);
gfx.PutPixel(x2,y2+5,255,255,255);
这些屏幕截图显示了问题所在


检查等号不应该是
==

这是您的问题:
如果((x2=100)
。在运算符周围使用空格会使此类错误更加明显。
if((x2=100)&&(y2==500))