这个特效来自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