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. This time, there is no need to alter the manifest because the default settings are the ones we want. So, navigate to proj.android and then to the jni folder and open the Android.mk file in a text editor.

  2. Edit the lines in LOCAL_SRC_FILES to read as follows:

    LOCAL_SRC_FILES := hellocpp/main.cpp \
                       ../../Classes/AppDelegate.cpp \
                       ../../Classes/GameLayer.cpp 
  3. Follow the instructions from the HelloWorld and AirHockey examples to import the game into Eclipse.

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

What just happened?

You just ran a universal app in Android. And nothing could have been simpler.

As a bonus, I've added another version of the game with an extra type of enemy to deal with: a UFO hell-bent on zapping the city! You may find this in 4198_04_BONUS_PROJECT.zip.

Pop quiz – sprites and actions

Q1...