DepthLayer(BugFixSceneLayerID theLayerID){ CCSize aScreenSize = CCDirector::sharedDirector()->getWinSize(); if (theLayerID == kBugFixSceneLayerDepth1) { mLayerId = kBugFixSceneLayerDepth1; std::string anAnimFileFullPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(SAM_ATTACK_FRONT); mAnimNode = SuperAnimNode::create(anAnimFileFullPath, 0, this); addChild(mAnimNode); mAnimNode->setPosition(ccp(aScreenSize.width * 0.5f, aScreenSize.height * 0.5f)); mAnimNode->PlaySection("attack"); CCLabelTTF* aLayer = CCLabelTTF::create("Beard is OK", "Arial", 24); addChild(aLayer); aLayer->setPosition(ccp(aScreenSize.width * 0.5f, aScreenSize.height * 0.35f)); } else if (theLayerID == kBugFixSceneLayerDepth2){ mLayerId = kBugFixSceneLayerDepth2; std::string anAnimFileFullPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(SAM_FADEIN_TAP); mAnimNode = SuperAnimNode::create(anAnimFileFullPath, 0, this); addChild(mAnimNode); mAnimNode->setPosition(ccp(aScreenSize.width * 0.5f, aScreenSize.height * 0.5f)); mAnimNode->PlaySection("fadein"); CCLabelTTF* aLayer = CCLabelTTF::create("Tap animation must be played", "Arial", 24); addChild(aLayer); aLayer->setPosition(ccp(aScreenSize.width * 0.5f, aScreenSize.height * 0.35f)); } else { CCAssert(false, "error"); } }
FadeinTapAnimLayer(){ CCSize aScreenSize = CCDirector::sharedDirector()->getWinSize(); std::string anAnimFileFullPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(SAM_FADEIN_TAP); mAnimNode = SuperAnimNode::create(anAnimFileFullPath, 0, this); addChild(mAnimNode); mAnimNode->setPosition(ccp(aScreenSize.width * 0.5f, aScreenSize.height * 0.5f)); mAnimNode->PlaySection("fadein"); }
AttackAnimLayer(){ CCSize aScreenSize = CCDirector::sharedDirector()->getWinSize(); std::string anAnimFileFullPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(SAM_ATTACK_FRONT); mAnimNode = SuperAnimNode::create(anAnimFileFullPath, 0, NULL); addChild(mAnimNode); mAnimNode->setPosition(ccp(aScreenSize.width * 0.5f, aScreenSize.height * 0.5f)); mAnimNode->PlaySection("attack", true); }
void OnAnimSectionEnd(int theId, std::string theLabelName){ // loop the animation if (theLabelName == "idle") { mAnimNode->PlaySection("active"); } if (theLabelName == "active") { mAnimNode->PlaySection("idle"); } }
void OnAnimSectionEnd(int theId, std::string theLabelName){ // loop the animation if (theLabelName == "fadein") { mAnimNode->PlaySection("tap"); } if (theLabelName == "tap") { mAnimNode->PlaySection("tap"); } }
SuperAnimNode *SuperAnimNode::create(std::string theAbsAnimFile, int theId, SuperAnimNodeListener *theListener) { SuperAnimNode *aSuperAnimNode = new SuperAnimNode(); if (aSuperAnimNode == NULL) { return NULL; } if (aSuperAnimNode->Init(theAbsAnimFile, theId, theListener) == false) { delete aSuperAnimNode; return NULL; } aSuperAnimNode->autorelease(); return aSuperAnimNode; }
void OnAnimSectionEnd(int theId, std::string theLabelName){ if (mLayerId == kBugFixSceneLayerDepth1) { if (theLabelName == "attack") { mAnimNode->PlaySection("attack"); } } if (mLayerId == kBugFixSceneLayerDepth2) { if (theLabelName == "fadein") { mAnimNode->PlaySection("tap"); } if (theLabelName == "tap") { mAnimNode->PlaySection("tap"); } } }
AlphaBlendLayer(BugFixSceneLayerID theLayerID){ CCSize aScreenSize = CCDirector::sharedDirector()->getWinSize(); std::string anAnimFileFullPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(SAM_FISH); mAnimNode = SuperAnimNode::create(anAnimFileFullPath, 0, this); addChild(mAnimNode, 1); mAnimNode->setPosition(ccp(aScreenSize.width * 0.5f, aScreenSize.height * 0.5f)); mAnimNode->PlaySection("idle"); CCSprite* aSprite = CCSprite::create("HelloWorld.png"); if (theLayerID == kBugFixSceneLayerAlphaBlend1) { addChild(aSprite, 0); aSprite->setAnchorPoint(ccp(1.0f, 0.5f)); aSprite->setPosition(ccp(aScreenSize.width * 0.5f, aScreenSize.height * 0.5f)); } else if (theLayerID == kBugFixSceneLayerAlphaBlend2){ addChild(aSprite, 2); aSprite->setAnchorPoint(ccp(0.0f, 0.5f)); aSprite->setPosition(ccp(aScreenSize.width * 0.5f, aScreenSize.height * 0.5f)); } }
NoFlickerLayer(){ CCSize aScreenSize = CCDirector::sharedDirector()->getWinSize(); std::string anAnimFileFullPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(SAM_NO_FLICKER); mAnimNode = SuperAnimNode::create(anAnimFileFullPath, 0, this); addChild(mAnimNode); mAnimNode->setPosition(ccp(aScreenSize.width * 0.5f, \ aScreenSize.height * 0.5f)); mCurSection = kSectionRightGo; mAnimNode->PlaySection(gSectionNames[mCurSection]); mLabelCurSection = CCLabelTTF::create(gSectionNames[mCurSection], "Arial", 24); addChild(mLabelCurSection); mLabelCurSection->setPosition(ccp(aScreenSize.width * 0.5f, \ aScreenSize.height * 0.85f)); CCLabelTTF* aLabelTip = CCLabelTTF::create("Tap the screen to play next section.\n no section flicker.", "Arial", 24); addChild(aLabelTip); aLabelTip->setPosition(ccp(aScreenSize.width * 0.5f, \ aScreenSize.height * 0.25f)); CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, -1, false); }
void OnAnimSectionEnd(int theId, std::string theLabelName){ mAnimNode->PlaySection(gSectionNames[mCurSection]); }
bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent){ mCurSection = (Section)((mCurSection + 1) % kSectionCnt); mAnimNode->PlaySection(gSectionNames[mCurSection]); mLabelCurSection->setString(gSectionNames[mCurSection]); return true; }