SHARE
TWEET

Untitled

a guest Jun 19th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 24);   //label 1
  2.     auto vecLabel = Vec2(visibleSize.width / 2, visibleSize.height - label->getContentSize().height);
  3.     label->setPosition(vecLabel);
  4.    
  5.     auto label2 = Label::createWithTTF("GAME", "fonts/Marker Felt.ttf", 30);        //label 2
  6.     label2->setPosition(100, 200);
  7.    
  8.     // position the label on the center of the screen
  9.     label->setPosition(Vec2(origin.x + visibleSize.width/2, origin.y + visibleSize.height - label->getContentSize().height));
  10.  
  11.     // add the label as a child to this layer
  12.     this->addChild(label, 1);
  13.     this->addChild(label2, 1);
  14.  
  15.     // add "HelloWorld" splash screen"
  16.     auto sprite = Sprite::create("HelloWorld.png");
  17.     auto vecSprite = Vec2(visibleSize.width / 2, visibleSize.height / 2);
  18.     sprite->setPosition(vecSprite);
  19.    
  20.    
  21.     // position the sprite on the center of the screen
  22.     sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
  23.  
  24.     // add the sprite as a child to this layer
  25.     this->addChild(sprite, 0);
  26.    
  27.     // exercise 02 sprite
  28.     cocos2d::Sprite* dSprite = cocos2d::Sprite::create("dog-animate.png");
  29.     dSprite->setPosition(Vec2(200, 50));
  30.     dSprite->setRotation(40);
  31.     dSprite->setScale(2.0);
  32.  
  33.     //actions
  34.     auto fadeIn = FadeIn::create(1.0f);
  35.     dSprite->runAction(fadeIn);
  36.    
  37.     auto moveBy = MoveBy::create(2, Vec2(200, 100));
  38.     dSprite->runAction(moveBy);
  39.    
  40.     auto moveTo = MoveTo::create(2, Vec2(200, 100));
  41.     dSprite->runAction(moveTo);
  42.    
  43.     dSprite->setRotation(30);
  44.     dSprite->setScale(4.0f);
  45.    
  46.     auto fadeOut = FadeOut::create(2.0f);
  47.     dSprite->runAction(fadeOut);
  48.  
  49.     //question2
  50.     auto bSprite = Sprite::create("bluemansprite.png");
  51.  
  52.     auto moveBy = MoveBy::create(2, Vec2(200, 0));
  53.     bSprite->runAction(moveBy);
  54.  
  55.     auto moveTo = MoveTo::create(2, Vec2(200, 50));
  56.     bSprite->runAction(moveTo);
  57.  
  58.     auto moveTo = MoveTo::create(2, Vec2(200, 100));
  59.     bSprite->runAction(moveTo);
  60.  
  61.     auto moveTo = MoveTo::create(2, Vec2(200, 150));
  62.     bSprite->runAction(moveTo);
  63.  
  64.     auto moveTo = MoveTo::create(2, Vec2(200, 200));
  65.     bSprite->runAction(moveTo);
  66.  
  67.     auto moveTo = MoveTo::create(2, Vec2(250, 100));
  68.     bSprite->runAction(moveTo);
  69.  
  70.  
  71.    
  72.  
  73.  
  74.    
  75.     return true;
RAW Paste Data
Want to get better at C++?
Learn to code C++ in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top