2286 auto s = Director::getInstance()->getWinSize();
2288 auto cache = SpriteFrameCache::getInstance();
2289 cache->addSpriteFramesWithFile(
"animations/grossini.plist");
2290 cache->addSpriteFramesWithFile(
"animations/grossini_gray.plist",
"animations/grossini_gray.png");
2292 auto spritesheet = SpriteBatchNode::create(
"animations/grossini.png");
2293 addChild(spritesheet);
2295 for(
int i=0;i<3;i++)
2300 auto sprite = Sprite::createWithSpriteFrameName(
"grossini_dance_01.png");
2301 sprite->setPosition( Vec2( s.width/4*(i+1), s.height/2) );
2303 auto point = Sprite::create(
"Images/r1.png");
2304 point->setScale( 0.25f );
2305 point->setPosition( sprite->getPosition() );
2306 addChild(point, 200);
2310 sprite->setAnchorPoint( Vec2::ANCHOR_BOTTOM_LEFT );
2313 sprite->setAnchorPoint( Vec2::ANCHOR_MIDDLE );
2316 sprite->setAnchorPoint( Vec2::ANCHOR_TOP_RIGHT );
2320 point->setPosition( sprite->getPosition() );
2322 Vector<SpriteFrame*> animFrames(14);
2323 char str[100] = {0};
2324 for(
int k = 0; k < 14; k++)
2326 sprintf(str,
"grossini_dance_%02d.png",(k+1));
2327 auto frame = cache->getSpriteFrameByName(str);
2328 animFrames.pushBack(frame);
2331 auto animation = Animation::createWithSpriteFrames(animFrames, 0.3f);
2332 sprite->runAction(RepeatForever::create( Animate::create(animation) ) );
2334 auto scale = ScaleBy::create(2, 2);
2335 auto scale_back = scale->reverse();
2336 auto seq_scale = Sequence::create(scale, scale_back,
nullptr);
2337 sprite->runAction(RepeatForever::create(seq_scale) );
2339 spritesheet->addChild(sprite, i);