Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void MainScene::createWalls()
- {
- std::vector<cocos2d::Color3B> usingColors;
- for (int i = 0; i<=colors.size()-1; i++)
- {
- usingColors.push_back(colors[i]);
- }
- Vec2 pBottom = Vec2(visibleSize.width/2,0);
- Vec2 pTop = Vec2(visibleSize.width/2,visibleSize.width);
- Vec2 pLeft = Vec2(0,visibleSize.width/2);
- Vec2 pRight = Vec2(visibleSize.width,visibleSize.width/2);
- if(this->getChildByTag(2))
- this->removeChild(this->getChildByTag(2));
- if(this->getChildByTag(3))
- this->removeChild(this->getChildByTag(3));
- if(this->getChildByTag(4))
- this->removeChild(this->getChildByTag(4));
- if(this->getChildByTag(5))
- this->removeChild(this->getChildByTag(5));
- int color ;
- int minSize = usingColors.size()-1;
- wtf(usingColors);
- color = random(0, minSize);
- Wall* wall1 = Wall::create(usingColors[color], pBottom);
- usingColors.erase(usingColors.begin() + color);
- wall1->setTag(2);
- this->addChild(wall1);
- minSize = usingColors.size()-1;
- wtf(usingColors);
- color = random(0, minSize);
- Wall* wall2 = Wall::create(usingColors[color], pTop);
- usingColors.erase(usingColors.begin() + color);
- wall2->setTag(3);
- this->addChild(wall2);
- minSize = usingColors.size()-1;
- wtf(usingColors);
- color = random(0, minSize);
- Wall* wall3 = Wall::create(usingColors[color], pLeft);
- usingColors.erase(usingColors.begin() + color);
- wall3->setTag(4);
- wall3->setRotation(90);
- this->addChild(wall3);
- minSize = usingColors.size()-1;
- color = random(0, minSize);
- Wall* wall4 = Wall::create(usingColors[color], pRight);
- usingColors.erase(usingColors.begin() + color);
- wall4->setTag(5);
- wall4->setRotation(90);
- this->addChild(wall4);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement