Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Building Android Games with Cocos2d-x
  • Toc
  • feedback
Building Android Games with Cocos2d-x

Building Android Games with Cocos2d-x

By : Hernandez
4.3 (8)
close
Building Android Games with Cocos2d-x

Building Android Games with Cocos2d-x

4.3 (8)
By: Hernandez

Overview of this book

If you have a basic understanding of the C++ programming language and want to create videogames for the Android platform, then this technology and book is ideal for you.
Table of Contents (10 chapters)
close
9
Index

Understanding sprites

In our game, the sprites represent the images of our scenes, just like the background, the enemies, and our player.

Later in Chapter 4, User Input, we will add event listeners to the scenes, so that it can interact with the user.

Creating sprites

It is very easy to instantiate the Cocos2d-x core classes. We have seen that the scene class has a create method; similarly, the sprite class has a static method with the same name, as we can see in the following code snippet:

auto sprBomb = Sprite::create("bomb.png");

Cocos2d-x currently supports PNG, JPG, and TIF image formats for sprites; nevertheless, it is highly recommended that we use the PNG images, because of its transparency capabilities, which are not present in either the JPG or the TIF format, and also because of the image quality that is provided by this format in a fair file size. That is why you will see that all the Cocos2d-x-generated templates and samples use this image format.

Positioning sprites

Once...

bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete