RUEfxShake.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef __RUEfxShake_H__
  2. #define __RUEfxShake_H__
  3. #include "cocos2d.h"
  4. #include "RUDefine.h"
  5. USING_NS_CC;
  6. NS_RU_BEGIN
  7. class RUEfxShake: public cocos2d::ActionInterval
  8. {
  9. public:
  10. RUEfxShake();
  11. ~RUEfxShake();
  12. // Create the action with a time and a strength (same in x and y)
  13. static RUEfxShake *create(float d, float strength);
  14. // Create the action with a time and strengths (different in x and y)
  15. static RUEfxShake *createWithStrength(float d, float strength_x, float strength_y,int interval = 1);
  16. bool initWithDuration(float d, float strength_x, float strength_y, int interval = 1);
  17. //是否启用加速度
  18. void enableAccel(bool enable) { m_accelEnable = enable;}
  19. protected:
  20. void startWithTarget(Node *pTarget);
  21. void update(float time);
  22. void stop();
  23. Vec2 m_StartPosition;
  24. // Strength of the action
  25. float m_strength_x, m_strength_y;
  26. int m_interval;
  27. int m_curFrameCount;
  28. bool m_accelEnable;
  29. };
  30. NS_RU_END
  31. #endif //__RUEfxShake_H__