本文介绍了不能在Cocos2d-x 3.0 alpha 2中使用效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对任何sprite / layer /场景使用任何效果总是会导致CCActionScript.cpp中的断言:

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");
}

因此,这个代码不会工作,因为Sprite或任何其他原语继承自Node(而不是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);

这是一个Alpha限制还是我做错了?

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

推荐答案

这是alpha版本的限制:

This is a limitation of alpha version:

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

这篇关于不能在Cocos2d-x 3.0 alpha 2中使用效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 20:02