Exemplo n.º 1
0
CCAction* SectionGuide::createClickAct_retain()
{
    string frames[] = {
        ResManager::getManager()->getSharedFilePath("finger.png"),
        ResManager::getManager()->getSharedFilePath("finger-Press.png"),
        ResManager::getManager()->getSharedFilePath("finger.png"),
        ResManager::getManager()->getSharedFilePath("finger-Press.png"),
        ResManager::getManager()->getSharedFilePath("finger.png")
    };
    CCAction* act = (CCFiniteTimeAction*)SpriteHelper::createAction(frames, 5, 0.5f,false);
    act->retain();
    return act;
}
Exemplo n.º 2
0
bool IntroLayer3::init()
{
	if(!CCLayer::init())
		return false;

	CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("Menus/Intro/Intro.plist");

	//CCSpriteFrame *firstFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bgIntro31.png");

	CCSprite *firstFrame = CCSprite::create("Menus/Intro/bgIntro31.png");
	this->addChild(firstFrame);

	CCSize size = CCDirector::sharedDirector()->getWinSize();

	firstFrame->setPosition(ccp(size.width/2,size.height/2));

	CCArray *frameArray = CCArray::create();
	frameArray->retain();

	for(int i =1;i<4;i++)
	{
		CCSpriteFrame *frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
			CCString::createWithFormat("bgIntro3%d.png",i)->getCString()
			);

		frameArray->addObject(frame);
	}

	CCAnimation *animation = CCAnimation::createWithSpriteFrames(frameArray,1.0f);
	CCAnimate *animate = CCAnimate::create(animation);

	CCAction *loopAction = CCSequence::create(animate,CCCallFunc::create(this,callfunc_selector(IntroLayer3::startGame)),NULL);
	loopAction->retain();

	firstFrame->runAction(loopAction);

	//firstFrame->runAction()


	return true;
}
Exemplo n.º 3
0
void Obstacle::SpawnCrow(int xOffset)
{
    CCArray *allFrames = new CCArray();
    for (int i = 0 ; i <= 14 ; i++)
    {
        char fn[64];
        sprintf(fn, "Fly00%d.png" , i );
        allFrames->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(fn));
    }
    
    CCAnimation *crowAnim = CCAnimation::createWithSpriteFrames(allFrames, 0.04f * 1);
    CCAction *crowAction = CCRepeatForever::create(CCAnimate::create(crowAnim));
    crowAction->retain();
    
    obstacleSprite = CCSprite::createWithSpriteFrameName("Fly000.png");
    obstacleSprite->setPosition(ccp(winSize.width + xOffset * SPAWN_OFFSET  , winSize.height - obstacleSprite->getContentSize().height));
    this->addChild(obstacleSprite);
    
    obstacleSprite->runAction(crowAction);
    moveOnce = true;
//    obstacleSprite->runAction(CCSequence::createWithTwoActions(CCMoveTo::create(1,
//                                                                                ccp( winSize.width - obstacleSprite->getContentSize().width , obstacleSprite->getPosition().y)),
//                                                               CCCallFunc::create(this, callfunc_selector(Obstacle::MoveCrow))));
}