में चल रहा है, मैं वर्तमान में कोकोस 2 डी-एक्स सीख रहा हूं और कुछ स्प्राइट एनीमेशन कर रहा हूं।
मेरा उद्देश्य यह है कि जब कोई बटन क्लिक किया जाता है तो ऑब्जेक्ट कुछ एनीमेशन के साथ छोड़ा जाता है। अब यदि आप तेजी से कई बार क्लिक करते हैं तो एनीमेशन तुरंत होता है और ऐसा लगता है कि भालू चलने की बजाए उम्मीद कर रहा है।जांचें कि एनीमेशन cocos2d-x
इसका समाधान सरल दिखता है कि मुझे यह जांचना चाहिए कि एनीमेशन पहले से चल रहा है या नहीं और नई एनीमेशन चलाने पर नहीं होना चाहिए।
निम्नलिखित मेरे कोड का एक हिस्सा है।
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("AnimBear.plist");
CCSpriteBatchNode* spriteBatchNode = CCSpriteBatchNode::create("AnimBear.png", 8);
this->addChild(spriteBatchNode,10);
CCArray *tempArray = new CCArray();
char buffer[15];
for (int i = 1; i <= 8 ; i++)
{
sprintf(buffer,"bear%i.png", i);
tempArray->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(buffer));
}
CCAnimation *bearWalkingAnimation = CCAnimation::create(tempArray,0.1f);
startAnimation = CCSprite::createWithSpriteFrameName("bear1.png");
startAnimation->setPosition(ccp (350 , CCDirector::sharedDirector()->getWinSize().height/2 -100));
startAnimation->setScale(0.5f);
startAnimation->setTag(5);
//Animation for bear walking
bearAnimate = CCAnimate::create(bearWalkingAnimation);
यहां भालूएनिमेट एक वैश्विक चर है और मैं जानना चाहता हूं कि यह वर्तमान में एनीमेशन खेल रहा है या नहीं।
मैं इसे कैसे कर सकता हूं?
धन्यवाद।
@ लांसग्रे: धन्यवाद दोस्त! –
क्या आप जानते हैं कि यह नियमित cocos2d में कैसा है? – RollRoll
@ThePoet मुझे लगता है कि समारोह एक जैसा है? –