2010-08-27 11:53:35 +08:00
|
|
|
#ifndef _BALL_H_
|
|
|
|
#define _BALL_H_
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
#include "cocos2d.h"
|
|
|
|
|
|
|
|
class Paddle;
|
|
|
|
|
2015-04-09 08:37:30 +08:00
|
|
|
class Ball : public cocos2d::Sprite
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2015-04-09 08:37:30 +08:00
|
|
|
cocos2d::Vec2 _velocity;
|
2012-04-19 14:35:52 +08:00
|
|
|
public:
|
|
|
|
Ball(void);
|
|
|
|
virtual ~Ball(void);
|
|
|
|
|
|
|
|
float radius();
|
2015-04-09 08:37:30 +08:00
|
|
|
//BOOL initWithTexture(cocos2d::Texture2D* aTexture);
|
|
|
|
//virtual void setTexture(cocos2d::Texture2D* newTexture);
|
2012-06-12 01:43:07 +08:00
|
|
|
void move(float delta);
|
2012-04-19 14:35:52 +08:00
|
|
|
void collideWithPaddle(Paddle* paddle);
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
2015-04-09 08:37:30 +08:00
|
|
|
void setVelocity(cocos2d::Vec2 velocity){_velocity = velocity;}
|
|
|
|
cocos2d::Vec2 getVelocity(){return _velocity;}
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
2015-04-09 08:37:30 +08:00
|
|
|
static Ball* ballWithTexture(cocos2d::Texture2D* aTexture);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|