Building Android Games with Cocos2d-x

Learn to create attractive and astonishing video games for Android utilizing Cocos2d-x

About This Book

  • Create enjoyable physics video games to rival the bestselling video games on Google Play
  • Save time by means of developing your Android video games utilizing this built-in framework
  • Learn to create an easy online game utilizing step by step directions supplied in the course of the book

Who This ebook Is For

If you've gotten a easy knowing of the C++ programming language and wish to create videogames for the Android platform, then this expertise and e-book is perfect for you.

What you'll Learn

  • Set up your paintings environment
  • Learn find out how to create picture components and animate them
  • Use the integrated physics engine to make your video games extra realistic
  • Manage person interplay utilizing the contact and accelerometer capabilities
  • Boost your game's appearance via studying so as to add textual content and utilizing real sort and bitmap fonts
  • Enhance your online game by way of including sound results and heritage music
  • Discover easy methods to upload wealthy explosion results utilizing particle systems
  • Add local Java code in your Android game

In Detail

Cocos2d-x is a multi-platform C++ gaming framework in lively improvement maintained by means of Chukong applied sciences. It wraps the entire crucial components wanted for making a video game, making the duty of online game construction very developer-friendly.

Starting with a necessary primer to get you up and working together with your improvement setting, you'll speedy dive in to exploring the newest model of this framework. you'll comprehend significant framework advancements to render items at lightning velocity, expand and hold code simply, and enhance the label API so as to add nice performance equivalent to glow, shadows, and descriptions to labels.

Through the construction of a true online game, you are going to discover the center elements of improvement together with Physics, permitting you to create real looking sprite hobbies, and particle structures to dynamically simulate explosions, fireplace, rain, and smoke, in addition to exploring the sound engine to make your video game extra strong. end via integrating Cocos2d-x C++ code with local Android code to release video games with the vintage Java Android application.

Show description

Preview of Building Android Games with Cocos2d-x PDF

Similar Computer Science books

PIC Robotics: A Beginner's Guide to Robotics Projects Using the PIC Micro

Here is every little thing the robotics hobbyist must harness the ability of the PICMicro MCU! during this heavily-illustrated source, writer John Iovine offers plans and entire components lists for eleven easy-to-build robots each one with a PICMicro "brain. ” The expertly written insurance of the PIC simple machine makes programming a snap -- and many enjoyable.

Measuring the User Experience: Collecting, Analyzing, and Presenting Usability Metrics (Interactive Technologies)

Successfully measuring the usability of any product calls for selecting the best metric, employing it, and successfully utilizing the knowledge it unearths. Measuring the person adventure offers the 1st unmarried resource of useful details to permit usability pros and product builders to just do that.

Information Retrieval: Data Structures and Algorithms

Details retrieval is a sub-field of machine technological know-how that bargains with the computerized garage and retrieval of files. delivering the newest info retrieval suggestions, this consultant discusses info Retrieval information buildings and algorithms, together with implementations in C. aimed toward software program engineers construction platforms with e-book processing parts, it presents a descriptive and evaluative rationalization of garage and retrieval platforms, dossier constructions, time period and question operations, rfile operations and undefined.

The Art of Computer Programming, Volume 4A: Combinatorial Algorithms, Part 1

The paintings of machine Programming, quantity 4A:  Combinatorial Algorithms, half 1   Knuth’s multivolume research of algorithms is well known because the definitive description of classical computing device technology. the 1st 3 volumes of this paintings have lengthy comprised a different and precious source in programming idea and perform.

Additional info for Building Android Games with Cocos2d-x

Show sample text content

Zero, Pause::createScene())); } void HelloWorld::initBackButtonListener(){ automobile listener = EventListenerKeyboard::create(); listener->onKeyPressed = [=](EventKeyboard::KeyCode keyCode, occasion* event){}; listener->onKeyReleased = CC_CALLBACK_2(HelloWorld::onKeyPressed, this); _eventDispatcher->addEventListenerWithScene GraphPriority(listener, this); } void HelloWorld::onKeyPressed(EventKeyboard::KeyCode keyCode, occasion* event){ if(keyCode == EventKeyboard::KeyCode::KEY_BACK){ Director::getInstance()->end(); } } As we will see within the following photo, we ultimately received our bunny to maneuver round the display and go away its preliminary principal place. [ sixty two ] Chapter four Please word that during the former code directory now we have passed over the segments of the code that aren't appropriate to this bankruptcy. as a way to see how the full code directory appears to be like at this aspect, you then can locate it within the source fabrics bundled with this ebook. precis during this bankruptcy, we allowed the consumer to manage our video game through the use of diversified enter mechanisms, that's, touching the display and relocating the telephone round with a purpose to use the accelerometer sensor; we have now additionally made our video game cease at any time when the again button is pressed. within the subsequent bankruptcy, we are going to disguise different methods of including textual content to our video games. [ sixty three ] Handling textual content and Fonts it's very universal in our video games so as to add textual content for showing details to the participant. this would be performed by utilizing both the TrueType fonts or bitmap fonts, with a purpose to enable us extra flexibility, and is, certainly, the main used kind of font in expert video games since it permits us to provide a customized glance to our video games. the subsequent issues should be coated during this bankruptcy: • growing TrueType font labels • including label results • growing approach fonts • growing bitmap font labels developing TrueType font labels including textual content by utilizing the TrueType font is de facto ordinary. Open the PauseScene. cpp implementation dossier that we've got created in bankruptcy 2, pix. within the init process, you'll find we have now created an example of the Label category through calling the static technique, createWithTTF. this system gets 3 parameters, the 1st one is the string that we wish to draw, the second is one other string representing the font dossier that you really want to exploit, together with the trail in the assets folder the place it really is situated, and the 3rd one represents the font dimension. The Label type used to be brought within the Cocos2d-x model three. x. It combines the TrueType font and the bitmap font dealing with in one classification. notwithstanding, even though deprecated, the previous label dealing with periods are nonetheless to be had in API for compatibility purposes. [ sixty five ] Handling textual content and Fonts Now, allow us to swap the 3rd parameter worth from 24 to ninety six within the createWithTTF way to make the font greater: automobile label = Label::createWithTTF("PAUSE", "fonts/Marker Felt. ttf", 96); The Marker Felt font is incorporated within the template Cocos2d-x undertaking generated by means of the cocos new command. developing our GameOverScene it really is now time to create a video game over scene, this can be displayed once a bomb crashes into our bunny sprite.

Download PDF sample

Rated 4.12 of 5 – based on 32 votes