2012-09-09 20:20:29 +08:00
|
|
|
#ifndef __HELLOWORLD_SCENE_H__
|
|
|
|
#define __HELLOWORLD_SCENE_H__
|
|
|
|
|
|
|
|
#include "cocos2d.h"
|
|
|
|
|
2013-07-23 02:08:46 +08:00
|
|
|
//#include "SimpleAudioEngine.h"
|
2012-09-09 20:20:29 +08:00
|
|
|
|
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);
|
|
|
|
|
2013-09-12 22:12:58 +08:00
|
|
|
virtual void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event) override;
|
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();
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2013-07-23 02:08:46 +08:00
|
|
|
#endif // __HELLOWORLD_SCENE_H__
|