Book Image

Building Android Games with Cocos2d-x

By : Raydelto Hernandez
Book Image

Building Android Games with Cocos2d-x

By: Raydelto Hernandez

Overview of this book

Table of Contents (16 chapters)
Building Android Games with Cocos2d-x
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Putting everything together


During this chapter, we have added the particle systems to our game for adding realistic explosions each time our player touches a bomb. To achieve this goal, we have modified the HelloWorldScene.h header file and the HelloWorldScene.cpp implementation file.

This is how our HelloWorldScene.h header file looks, after the modifications made during this chapter:

#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__
#include "cocos2d.h"
#include "PauseScene.h"
#include "GameOverScene.h"

class HelloWorld : public cocos2d::Layer{
public:
  static cocos2d::Scene* createScene();
  virtual bool init();
  CREATE_FUNC(HelloWorld);
private:
  cocos2d::Director *_director;
  cocos2d::Size _visibleSize;
  cocos2d::Sprite* _sprBomb;
  cocos2d::Sprite* _sprPlayer;
  cocos2d::Vector<cocos2d::Sprite*> _bombs;
  cocos2d::MenuItemImage* _muteItem;
  cocos2d::MenuItemImage* _unmuteItem;
  int _score;
  int _musicId;
  void initPhysics();
  void pauseCallback(cocos2d:...