bool BugParticleBufOverflowLayer::init()
{
    if (BugsTestBaseLayer::init())
    {
        CCSize size = CCDirector::sharedDirector()->getWinSize();

		CCParticleFlower *first = new CCParticleFlower();
	    first->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_stars1) );
		first->initWithTotalParticles(5);
		first->autorelease();
		first->setPosition(ccp(size.width/4, size.height/4));
		addChild(first);


		CCParticleFlower *second = new CCParticleFlower();
	    second->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_stars2) );
		second->initWithTotalParticles(99);
		second->autorelease();
		second->setPosition(ccp(size.width*3/4, size.height*3/4));
		addChild(second);

        return true;
	}

	return false;
}
示例#2
0
void RS_Main::RunParticle(int nBlankTag)
{
    //RS_Blank* pBlank = (RS_Blank*)m_scrollVA->getChildByTag(nBlankTag);
    RS_Blank* pBlank = (RS_Blank*)m_arrImgA.objectAtIndex(nBlankTag-1);
    if (NULL == pBlank)
        return;

    CCParticleFlower* ps = CCParticleFlower::create();
    ps->setTexture( CCTextureCache::sharedTextureCache()->addImage("common/game/stars.png"));
    ps->retain();
    ps->setDuration(1.2f);

    float fScale = pBlank->m_fSpriteScale;
    CCSize sizeB = pBlank->boundingBox().size;

    // 자신의 w, h를 나눠서 복제본 위치를 설정하면 될듯하나
    // 텍스쳐가 스케일이 적용된 상태로 복제되어 블럭의 스케일로 Blank의 w, h를 나눠줌.
    sizeB.width  /= fScale;
    sizeB.height /= fScale;

    CCRect rcBB = pBlank->boundingBox();

    ps->setPosition(ccp(0, 0));
    pBlank->addChild(ps, 1000);

    // 테두리 이동하며 효과주기
    CCActionInterval* move1 = CCMoveBy::create(0.3f, ccp(0, sizeB.height));
    CCActionInterval* move2 = CCMoveBy::create(0.3f, ccp(sizeB.width, 0));
    CCActionInterval* move3 = CCMoveBy::create(0.3f, ccp(0, -sizeB.height));
    CCActionInterval* move4 = CCMoveBy::create(0.3f, ccp(-sizeB.width, 0));

    CCFiniteTimeAction* seq = CCSequence::create( move1, move2, move3, move4, NULL);
    ps->runAction(seq);
}