c++directx-10

Proggraming C++ and DirectX


I have a problem... I work in M.V.C++ 2010 Express and with DirectX. I have to make a target moving in square. But when to draw the points my variablres(x, y) are reseting...

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);

These screen shots show the problem

Game constructor Debuggin step 1 Debuggin step 2 Debuggin step 3


Solution

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

    check the equal sign shouldn't be ==?