9
« on: January 10, 2012, 02:21:52 am »
if(sf::Mouse::IsButtonPressed(sf::Mouse::Left)){
if( (bulletPos.x < cubezPos.x) && (sf::Mouse::IsButtonPressed(sf::Mouse::Left) ) ){
//Bullet.SetPosition(bulletPos.x + bulletSpeed , bulletPos.y);
//Cubez.SetPosition(cubezPos.x - cubezSpeed , cubezPos.y);
Sleep(1000);
Bullet.SetPosition(338.5, 305);
Cubez.SetPosition(500, 295);
Window.Draw(Bullet);
Window.Draw(Cubez);
Sleep(1000);
Bullet.SetPosition(491 , 305);
Cubez.SetPosition(330 , 295);
Window.Draw(Bullet);
Window.Draw(Cubez);
}
if((bulletPos.x > cubezPos.x) && (sf::Mouse::IsButtonPressed(sf::Mouse::Left))){
Cubez.SetPosition(0 , 295);
Sleep(3000);
}
}
When I hold down the left mouse button it's suppose to wait a second, move both sprites to their respectful positions then wait another second and move them again and then finish, but when I hold down the left mouse button it just waits like 2 seconds and moves each sprite to the second pair of coordinates.
Why does it not work???