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

删除回忆录丶 提交于 2020-01-06 09:59:05

问题


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)
[...]


来源:https://stackoverflow.com/questions/22650122/cant-use-effects-in-cocos2d-x-3-0-alpha-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!