Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sf::Vector2f randomLocation(sf::Rect<float> rect)
- {
- int randx = -1;
- int randy = -1;
- int left = (int)rect.Left;
- int right = (int)rect.Width;
- int top = (int)rect.Top;
- int bottom = (int)rect.Height;
- while(rand > right || rand < left)
- {
- randx = rand();
- }
- while(rand > bottom || rand < top)
- {
- randy = rand();
- }
- return sf::Vector2f(randx, randy);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement