void BlockManager::loadResource() { CHAR szTemp[128] = {0}; CCAnimation* Ani = new CCAnimation; m_pBgaSprite = CCSprite::spriteWithTexture(ResourceManager::sharedManager()->getMap(67)); m_pBgaSprite->setAnchorPoint(ccp(0,0)); m_pBgaSprite->setPosition(ccp(-1000,-1000)); m_pGround->addChild(m_pBgaSprite); Ani->initWithName("TILE"); for(int i=0; i<6; i++) { sprintf_s(szTemp, "Tile/Tile_Ground_%d.png",i); Ani->addFrameWithFileName(szTemp); } m_pBlockSprite = new CCSprite; m_pBlockSprite->init(); m_pBlockSprite->setAnchorPoint(ccp(0,0)); m_pBlockSprite->addAnimation(Ani); m_pBlockSprite->setIsVisible(false); m_pBlockSprite->setPosition(ccp(-1000,-1000)); m_pGround->addChild(m_pBlockSprite); m_bLoaded = true; m_bLook = false; m_pBlock = new Object_block; m_pBlock->initWithBlock(); }
CCAnimation* CCAnimation::animationWithName(const char *pszName, float fDelay, CCMutableArray<CCSpriteFrame*> *pFrames) { CCAnimation *pAnimation = new CCAnimation(); pAnimation->initWithName(pszName, fDelay, pFrames); pAnimation->autorelease(); return pAnimation; }
CCAnimation* CCAnimation::animationWithName(const char *pszName, float fDelay) { CCAnimation *pAnimation = new CCAnimation(); pAnimation->initWithName(pszName, fDelay); pAnimation->autorelease(); return pAnimation; }
Portrait::Portrait() { CCSprite::init(); CCTexture2D *portaits = Manager_Resource::getInstance()->getResourceWithString("portrait"); CCAnimation *pPA = new CCAnimation; pPA->initWithName("PORTRAIT"); pPA->addFrameWithTexture(portaits, CGRect(0, 0, 1, 1)); for (int n = 0; n < MAX_CHARACTER_NUMBER+1; n++) { pPA->addFrameWithTexture(portaits, CGRect(226*(n%8),(n/8) * 482 , 224, 480)); } this->addAnimation(pPA); }