Ok i am getting stuck with the maths on how to make a box move left to right over and over none stop , i understand you change the position by the velocity but i dont understand how to get the if conditions right so it actually moves none stop,here is what i have
d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
d3ddev->Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
d3ddev->BeginScene(); D3DXMatrixTranslation(&matTrans,Pos.x+velocity,Pos.y,Pos.z);
d3ddev->SetTransform(D3DTS_WORLD, &(matTrans));
box->DrawSubset(0); d3ddev->EndScene();
d3ddev->Present(NULL, NULL, NULL, NULL);