C++ 和 DirectX 编程

Proggraming C++ and DirectX

我有一个问题...我在 M.V.C++ 2010 Express 和 DirectX 中工作。 我必须让一个目标在正方形中移动。但是什么时候画点我的 variablres(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);

这些屏幕截图显示了问题

if((x2=100)&&(y2==500))

检查等号不应该是==?