Book Image

Cocos2d-x by Example: Beginner's Guide

By : Roger Engelbert
Book Image

Cocos2d-x by Example: Beginner's Guide

By: Roger Engelbert

Overview of this book

Table of Contents (19 chapters)
Cocos2d-x by Example Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – running the game in Android


Follow these steps to deploy the game to Android:

  1. Open the manifest file and set the app orientation to portrait.

  2. Next, open the Android.mk file in a text editor.

  3. Edit the lines in LOCAL_SRC_FILES to read:

    LOCAL_SRC_FILES := hellocpp/main.cpp \
                       ../../Classes/AppDelegate.cpp \
                       ../../Classes/GameSprite.cpp \
                       ../../Classes/LineContainer.cpp \
                       ../../Classes/Rocket.cpp \
                       ../../Classes/GameLayer.cpp  
  4. Import the game into Eclipse and build it.

  5. Save and run your application. This time, you can try out different size screens if you have the devices.

What just happened?

You now have Rocket Through running in Android.

Have a go hero

Add logic to the resetStar method so that the new position picked is not too close to the _rocket sprite. So, make the function a recurrent one until a proper position is picked.

And take the warp particle system, which right now does not...