cocos2dx¶¯»Animation½éÉÜ(2)
À´Ô´£ºÎ´Öª ÔðÈα༣ºÔðÈα༠·¢±íʱ¼ä:2013-11-17 14:34¡¡µã»÷:´Î
p>addChild(spritebatch);
p>
p>
p>createWithSpriteFrameName ·½·¨½«»á´Ógrossini.plistÖÐÕÒµ½¶ÔÓ¦µÄ×ø±êÒÔ¼°¾ØÐÎÇøÓò£¬Ö®ºóÔٲüôgrossini.pngµÄÎÆÀí³ÉÒ»¸ö¾«ÁéÖ¡¡£
p>
p>
p>ÏÖÔÚÎÒÃÇ´´½¨Ò»¸öCCArray¶ÔÏó²¢ÇÒÌì½£ËùÓеÄÖ¡¶¯»½øÈ¥¡£ÔÚÕâ¸ö¶¯»µÄÀý×ÓÖУ¬ÎÒÃÇ·¢ÏÖËùÓеÄ14Ö¡¶¼ÓÐÏàͬµÄ´óС£¬ËùÒÔÎÒÃÇ¿ÉÒÔÓÃÒ»¸öǶÌ×µÄÑ»·±éÀúËüÃÇ£¬²¢ÇÒµ±Íê³ÉÌí¼Ó14Ö¡Ö®ºó½áÊøµôÑ»·¡£
p>[cpp]
p>CCArray* animFrames = CCArray::createWithCapacity(15);
p>char str[100] = {0};
p>
p>for(int i = 1; i < 15; i++)
p>{
p> sprintf(str, "grossini_dance_%02d.png", i);
p> CCSpriteFrame* frame = cache->spriteFrameByName( str );
p> animFrames->addObject(frame);
p>}
p>
p>×îºó£¬ÎÒÃÇÐèÒª´´½¨Ò»¸öCCAnimate¶¯×÷ʵÀýÀ´ÔËÐÐCCSprite¡£ÏÂÃæÎÒÃÇ¿ÉÒÔÔÚCCRepeatForever¶¯×÷Öаü¹üCCAnimate¶¯×÷À´ÈÃËüÒ»Ö±Ö´ÐÐÏÂÈ¥£¬ÏñÕâÑù£º
p>[cpp]
p>CCAnimation* animation = CCAnimation::createWithSpriteFrames(animFrames, 0.3f);
p>m_pSprite1->runAction( CCRepeatForever::create( CCAnimate::create(animation) ) );
p>
p>ËÄ¡¢Îļþ¶¯»
p>CCAnimateCacheÄܹ»¼ÓÔØÒ»¸öÃèÊöÒ»Åú½ÚµãµÄxml/plistÎļþ£¬°üÀ¨Ö¡ÃûºÍËûÃǵľØÐÎÇøÓò¡£Õâ¸ö½è¿Ú·Ç³£ÈÝÒ×ʹÓá£
p>[cpp]
p>CCAnimationCache *cache = CCAnimationCache::sharedAnimationCache(); // »º´æÔÚcocos2dxÖÐÒ»Ö±Êǵ¥Àýģʽ
p>cache->addAnimationsWithFile("animations/animations-2.plist");
p>CCAnimation animation = cache->animationByName("dance_1");
p>CCAnimate animate = CCAnimate::create(animation);
p>sprite->runAction(animate);
Ïà¹ØÐÂÎÅ>>
- Cocos2dx3.2±àд³£ÓÃUI×é¼þ£¨Ò»£©ÐÂÊÖÖ¸µ¼¿òGuideLayer
- cocos2dxÖ®²ÊÉ«±à¼ÊäÈë¿òµÄÉè¼Æ
- Cocos2dx3.2±àд³£ÓÃUI×é¼þ£¨Èý£©ÊÕ¼¯Æ÷Ч¹ûCollector
- cocos2dx 3.2 ²Ã¼ô½Úµã ClippingNode
- cocos2dxÖ®³é½±½çÃæÓë»ñ½±¸ÅÂʵÄÉè¼Æ(Ò»)
- cocos2dx±³¾°Í¸Ã÷´¦Àí
- cocos2dx 3.xÅжÏnodeµã»÷ÇøÓòÊÇ·ñ͸Ã÷
- cocos2dxµÄrunAction: Öظ´Ö´ÐÐ,¶à¸ö¶¯×÷Á¬½ÓÖ´ÐÐ,¶à¸ö¶¯×÷ͬʱ
- ¹ØÓÚcocos2dx luaÖеÄcloneº¯ÊýµÄÔ´Âë½â¶Á
- cocos2dx V3.2 mac os Xcode6.1 »·¾³ÅäÖÃ
×îÐÂÍƼö¸ü¶à>>>
ÈÈÃÅÐÂÎŽøÈëÒƶ¯¿ª·¢ÆµµÀ>>
- ·¢±íÆÀÂÛ
-
- ×îÐÂÆÀÂÛ ¸ü¶à>>
Äú¿ÉÄܸÐÐËȤµÄÎÄÕÂ
- cocos2d(CCSprite°ó¶¨²»¹æÔò¸ÕÌåÓ뾫ÁéÒ»ÆðÒƶ¯)
- cocos2dʹÓð뵥Àý
- Yiiѧϰ(3)----ºËÐÄÓ¦ÓÃ×é¼þ
- cocos2d-x°æFishingJoy(²¶Óã´ïÈË)ʾÀý
- Cocos2d-x 2.0 Ö® Actions ¡°Èý°å¸«¡± Ö®Ò»
- cocos2d-xna дµÄÒ»¸öСÓÎÏ·demo̹¿Ë´óÕ½
- cocos2d-x ÕÏ°Óë·ÏßµÄË«ÖØ¿ØÖÆ
- PhoneGap APIÖÐÎÄ°ïÖúÎĵµ¡ª¡ªConnection£¨Á¬½Ó£©
- cocos2d¿ª·¢Ñ§Ï°¶þ£º¹ØÓÚ Director£¬Scenes£¬ Layers
- wince5.0 eVCÖÐʵÏÖCCheckListBox£¬ListboxÖдø¸´Ñ¡¿òµÄ