cocos2d-x 3.0屏幕 抖动特效 重写CCShake

本文介绍了如何在cocos2d-x 3.0版本中修复并重写屏幕抖动特效,内容源于http://blog.csdn.net/z104207/article/details/11573271,解决了之前代码存在的问题。
摘要由CSDN通过智能技术生成

这个特效来自http://blog.csdn.net/z104207/article/details/11573271

之前流传的这个代码一直有错误,我使用3.0的方法重新实现了一下

#ifndef __FiveSeconds__Shake__
#define __FiveSeconds__Shake__


#include "cocos2d.h"
USING_NS_CC;

class Shake : public ActionInterval
{
public:
    Shake();
    
    // Create the action with a time and a strength (same in x and y)
    static Shake *create(float d, float strength );
    
    // Create the action with a time and strengths (different in x and y)
    static Shake *createWithStrength(float d, float strength_x, float strength_y );
    
    bool initWithDuration(float d, float strength_x, float strength_y );
    
protected:
    
    void startWithTarget(cocos2d::Node *pTarget);
    void update(float time);
    void stop(void);
    
    virtual ActionInterval* reverse() const;
    virtual ActionInterval* clone() const;
    
    Point m_StartPosition;
    Node* m_pTarget;
    
    // Strength of the action
    floa
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值