cocos2d-x的游戏引擎提供了很多动作特效来给我们使用,但是参数的使用上面并没有很详细的解释。
还是要靠大家去探索,去发现,这是一种乐趣。
先看第一个特效,就是3D晃动的效果。
/** @brief CCShakyTiles3D action */
class CC_DLL CCShakyTiles3D : public CCTiledGrid3DAction
{
public:
/** initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration */
virtual bool initWithDuration(float duration, const CCSize& gridSize, int nRange, bool bShakeZ);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(float time);
public:
/** creates the action with a range, whether or not to shake Z vertices, a grid size, and duration */
static CCShakyTiles3D* create(float duration, const CCSize& gridSize, int nRange, bool bShakeZ);
protected:
int m_nRandrange;
bool m_bShakeZ;
};
//第一参数,特效时间;
//第二参数,晃动的尺寸
//第三参数,晃动的等级,参数数值越大,以精灵为中心的圆的半径越大
//第四参数,Z轴晃动
CCActionInterval *shaky = CCShakyTiles3D::create(5,CCSizeMake(1,1),10,true);
pSprite->runAction(shaky);