Can't use effects in Cocos2d-x 3.0 alpha 2

2019-08-31 12:51发布

问题:

Using of any effect for any sprite/layer/scene always causes this assertion in CCActionScript.cpp:

void GridAction::cacheTargetAsGridNode()
{
    _gridNodeTarget = dynamic_cast<NodeGrid*> (_target);
    CCASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid");
}

So, this code won't work because of Sprite or any other primitive are inherited from Node (not from NodeGrid). In other words, sample application won't work too:

CCSprite* sp = CCSprite::create("title.jpg");  
sp->setPosition(ccp(240, 160));  
addChild(sp);  
CCActionInterval* pageTurn3D = CCPageTurn3D::create(4, CCSize(20, 20));  
sp->runAction(pageTurn3D); 

Is it an alpha limitation, or am I doing something wrong?

回答1:

This is a limitation of alpha version:

*    - Limitations
[...]
 *        - GridBase actions are not supported (eg: Lens, Ripple, Twirl)
[...]