cocos2d-x 如何指定Sprite 抖动效果!
2个回答
展开全部
让Sprite 无限次的执行Rotation动画,就可以实现抖动效果了。
希望能帮助到你。
希望能帮助到你。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
实现抖动的代码如下:
#ifndef __SHAKE_H__
#define __SHAKE_H__
#include "cocos2d.h"
USING_NS_CC;
class CCShake : public cocos2d::CCActionInterval
{
public:
CCShake();
// Create the action with a time and a strength (same in x and y)
static CCShake *create(float d, float strength );
// Create the action with a time and strengths (different in x and y)
static CCShake *createWithStrength(float d, float strength_x, float strength_y );
bool initWithDuration(float d, float strength_x, float strength_y );
protected:
void startWithTarget(cocos2d::CCNode *pTarget);
void update(float time);
void stop(void);
CCPoint m_StartPosition;
// Strength of the action
float m_strength_x, m_strength_y;
};
#endif //__SHAKE_H__
#ifndef __SHAKE_H__
#define __SHAKE_H__
#include "cocos2d.h"
USING_NS_CC;
class CCShake : public cocos2d::CCActionInterval
{
public:
CCShake();
// Create the action with a time and a strength (same in x and y)
static CCShake *create(float d, float strength );
// Create the action with a time and strengths (different in x and y)
static CCShake *createWithStrength(float d, float strength_x, float strength_y );
bool initWithDuration(float d, float strength_x, float strength_y );
protected:
void startWithTarget(cocos2d::CCNode *pTarget);
void update(float time);
void stop(void);
CCPoint m_StartPosition;
// Strength of the action
float m_strength_x, m_strength_y;
};
#endif //__SHAKE_H__
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询