Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How can i move a group of rectangles at the same time?  (Read 1263 times)

0 Members and 1 Guest are viewing this topic.

moonbeamer2234

  • Newbie
  • *
  • Posts: 10
    • View Profile
How can i move a group of rectangles at the same time?
« on: August 09, 2012, 03:44:30 am »
I have a Block in the shape of a T that looks like this
topleft.setPosition(middletop.getPosition().x-10, middletop.getPosition().y);
topleft.setFillColor(sf::Color::Red);
righttop.setPosition(middletop.getPosition().x+10, middletop.getPosition().y);
righttop.setFillColor(sf::Color::Blue);
bottom1.setPosition(middletop.getPosition().x, middletop.getPosition().y+10);
bottom1.setFillColor(sf::Color::Cyan);
bottom2.setPosition(bottom1.getPosition().x, bottom1.getPosition().y+10);
bottom2.setFillColor(sf::Color::Green);
middleblock is stationary and the other rectangles are build around it at the top of the page.
I want the all 5 rectangles to fall at the same time so i tried using a non void prototype and i think i might be on the right track but maybe im missing something that i cant figure out.
sf::RectangleShape tblock (sf::RectangleShape topleft, sf::RectangleShape middletop, sf::RectangleShape righttop,sf::RectangleShape bottom1, sf::RectangleShape bottom2)
,,
,,
,,
//Than for intitialising i did this
sf::RectangleShape tblock (sf::RectangleShape topleft, sf::RectangleShape middletop, sf::RectangleShape righttop,sf::RectangleShape bottom1, sf::RectangleShape bottom2).move(0, 1);
 
But nothing happened! Im so stumped maybe im just really overcomplicating everything. I tend to do that sometimes.  ;D Please help :(

 

anything