Cocos2d-X游戏开发之3D晃动特效参数详解

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








评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值