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;
|
|
|
|
|
2012-06-14 05:19:13 +08:00
|
|
|
USING_NS_CC;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class Ball : public Sprite
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
Point _velocity;
|
2012-04-19 14:35:52 +08:00
|
|
|
public:
|
|
|
|
Ball(void);
|
|
|
|
virtual ~Ball(void);
|
|
|
|
|
|
|
|
float radius();
|
2013-06-20 14:17:10 +08:00
|
|
|
//BOOL initWithTexture(Texture2D* aTexture);
|
|
|
|
//virtual void setTexture(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:
|
2013-06-20 14:17:10 +08:00
|
|
|
void setVelocity(Point velocity){_velocity = velocity;}
|
|
|
|
Point getVelocity(){return _velocity;}
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static Ball* ballWithTexture(Texture2D* aTexture);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|