Trying to figure out how to get an object moving within the bounds of a window....
So I now have a bitmap moving at a "slow"pass from left to right in a window ap. Everytime it hits the right boundry it gets moved back to 0(x-plane)and down 50(y-plane) pixels. Hear is that code for that part
I acheived it moving at a "slow" pace by making a call to the Sleep() function in my main loop. Beautiful! Anyways I am now that I actually have the bitmap moving in a fashion I want it to, I need to take it one step further. I need to get the bitmap to move in random directions with in the bounds of the form. How would you suggest to do this? I tried a few diffrent if statments out but it seems one defeats the other as the build up.
if (rect.right > 0)
gPosX = gPosX + 1;
if ( gPosX >= rect.right )
gPosY = gPosY + 50;
gPosX = 0;
if ( gPosY > rect.bottom - 60 )
gPosY = 0;
DrawBitmap(global_hdc, "c.bmp", gPosX, gPosY);
Any suggestions would be great....