Thanks for the help but I think I figured it out a few days ago....Hear is what I ended up doing..
Code:
if (rect.right > 0)
{
gPosX = gPosX + xDirection;
gPosY = gPosY + yDirection;
//Handles movement in the X-axis
if (gPosX > rect.right - 85)
{
PlaySound("crashA.wav",0,SND_ASYNC|SND_FILENAME);
xDirection = -1;
}
else if (gPosX < rect.left)
{
PlaySound("crashB.wav",0,SND_ASYNC|SND_FILENAME);
xDirection = 1;
}
//Handles movement in the Y-axis
if (gPosY > rect.bottom - 140)
{
PlaySound("crashA.wav",0,SND_ASYNC|SND_FILENAME);
yDirection = -1;
}
else if (gPosY < rect.top)
{
PlaySound("crashB.wav",0,SND_ASYNC|SND_FILENAME);
yDirection = 1;
}
DrawBitmap(global_hdc, "c.bmp", gPosX, gPosY);
}
By the way why won't sleep() work on slower computers...