Cocos2d-x学习笔记1

时间:2023-02-06 19:59:10

 1.    
      CCScaleTo* scaleTo=CCScaleTo::create(0.3f,0.6f);

      CCActionInterval* scaleByReverse=scaleTo->reverse();
       运行程序报错:  

Cocos2d-x学习笔记1
换为:
 CCScaleBy* scaleBy=CCScaleBy::create(0.3f,0.6f);

 CCActionInterval* scaleByReverse=scaleBy->reverse();


2. 
CSprite* sprite=CCSprite::createWithTexture(bulletBatchNode->getTexture());

 CCScaleBy* scaleBy=CCScaleBy::create(0.3f,0.6f);

 CCActionInterval* scaleByReverse=scaleBy->reverse();

CCSequence* seq = CCSequence::createWithTwoActions(scaleBy,scaleByReverse);

CCRepeatForever* rep=CCRepeatForever::create(seq);

CCMoveBy* moveby=CCMoveBy::create(5.0f, ccp(100,100));

CCSpawn* spawn = CCSpawn::create(rep,moveby,NULL);
sprite->runAction(spawn); 

缩放效果没有;
将 "CCRepeatForever* rep=CCRepeatForever::create(seq);"
换为"CCRepeat* rep=CCRepeat::create(seq , 10);"
有缩放效果。