2012-09-09 20:20:29 +08:00
|
|
|
#ifndef __HELLOWORLD_SCENE_H__
|
|
|
|
#define __HELLOWORLD_SCENE_H__
|
|
|
|
|
|
|
|
#include "cocos2d.h"
|
|
|
|
|
|
|
|
#include "SimpleAudioEngine.h"
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class HelloWorld : public cocos2d::LayerColor
|
2012-09-09 20:20:29 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
HelloWorld();
|
|
|
|
~HelloWorld();
|
|
|
|
|
|
|
|
// Here's a difference. Method 'init' in cocos2d-x returns bool,
|
|
|
|
// instead of returning 'id' in cocos2d-iphone
|
|
|
|
virtual bool init();
|
|
|
|
|
|
|
|
// there's no 'id' in cpp, so we recommand to return the exactly class pointer
|
2013-06-20 14:17:10 +08:00
|
|
|
static cocos2d::Scene* scene();
|
2012-09-09 20:20:29 +08:00
|
|
|
|
|
|
|
// a selector callback
|
2013-07-26 06:53:24 +08:00
|
|
|
virtual void menuCloseCallback(cocos2d::Object* sender);
|
2012-09-09 20:20:29 +08:00
|
|
|
|
|
|
|
// implement the "static node()" method manually
|
|
|
|
CREATE_FUNC(HelloWorld);
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
void spriteMoveFinished(cocos2d::Node* sender);
|
2012-09-09 20:20:29 +08:00
|
|
|
|
|
|
|
void gameLogic(float dt);
|
|
|
|
|
|
|
|
void updateGame(float dt);
|
|
|
|
|
|
|
|
void registerWithTouchDispatcher();
|
2013-06-20 14:17:10 +08:00
|
|
|
void ccTouchesEnded(cocos2d::Set* touches, cocos2d::Event* event);
|
2012-09-09 20:20:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2013-06-20 14:17:10 +08:00
|
|
|
cocos2d::Array *_targets;
|
|
|
|
cocos2d::Array *_projectiles;
|
2012-09-09 20:20:29 +08:00
|
|
|
int _projectilesDestroyed;
|
|
|
|
|
|
|
|
void addTarget();
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __HELLOWORLD_SCENE_H__
|