Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. int radius= 32;
  2. float scaleImage= 0.5;
  3. int nItem= 60;
  4. float pMargin= 5;
  5.  
  6. int limitTime= 70;
  7. float timeWaiting= 8;
  8. bool opTouch= true;
  9. int lastIndex= -1;
  10. Size visibleSize;
  11.  
  12. CCArray *arrCs;
  13.  
  14. bool MainGame::init(){
  15. arrCs= CCArray::create();
  16.  
  17. int xx= pMargin+ radius;
  18. int yy= pMargin+ radius;
  19.  
  20. int inLabel= 0;
  21. for (int i=0; i<nItem; i++) {
  22. inLabel= i;
  23. if (i>((nItem/2)-1)) {
  24. inLabel= i-(nItem/2);
  25. }
  26.  
  27. CCString *iconName= CCString::createWithFormat("ricon_%i.png", inLabel);
  28. Sprite *cs= CCSprite::create(iconName->getCString());
  29. cs->setPosition(Point(xx, yy));
  30. cs->setTag(-1);
  31. cs->setScale(scaleImage);
  32.  
  33. /*****SET VALUE FOR arrCs ******************/
  34. arrCs->addObject(cs);
  35.  
  36. this->addChild(cs, (1+ rand()%3));
  37.  
  38. xx= xx+ (radius*2)+ pMargin;
  39. if (xx+ (radius/2)> visibleSize.width) {
  40. xx= radius + pMargin;
  41. yy= yy+(radius*2)+ pMargin;
  42. }
  43. }
  44. }
  45.  
  46.  
  47.  
  48.  
  49. void MainGame::onTouchesEnded(const std::vector<Touch*>& touches, Event* event){
  50. /******** arrCs has nothing ************/
  51. for (int i=0; i< arrCs->count(); i++) {
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement