1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #ifndef __RUEfxShake_H__
- #define __RUEfxShake_H__
-
- #include "cocos2d.h"
- #include "RUDefine.h"
- USING_NS_CC;
-
- NS_RU_BEGIN
-
- class RUEfxShake: public cocos2d::ActionInterval
- {
- public:
- RUEfxShake();
- ~RUEfxShake();
-
- // Create the action with a time and a strength (same in x and y)
- static RUEfxShake *create(float d, float strength);
-
- // Create the action with a time and strengths (different in x and y)
- static RUEfxShake *createWithStrength(float d, float strength_x, float strength_y,int interval = 1);
-
- bool initWithDuration(float d, float strength_x, float strength_y, int interval = 1);
-
- //是否启用加速度
- void enableAccel(bool enable) { m_accelEnable = enable;}
-
- protected:
- void startWithTarget(Node *pTarget);
- void update(float time);
- void stop();
-
- Vec2 m_StartPosition;
-
- // Strength of the action
- float m_strength_x, m_strength_y;
- int m_interval;
- int m_curFrameCount;
-
- bool m_accelEnable;
- };
- NS_RU_END
-
- #endif //__RUEfxShake_H__
|