Cocos2d-x is a suite of open source, cross-platform game-development tools used by thousands of developers all over the world. Cocos2d-x is a game framework written in C++, with a thin platform-dependent layer. Completely written in C++, the core engine has the smallest footprint and the fastest speed of any other game engine, and is optimized to be run on all kinds of devices.
You will begin with the initial setup and installation of Cocos2d before moving on to the fundamentals needed to create a new project. You will then explore and create the sprites, animations, and actions that you will include in the game. Next, you will look at strings and create labels, including a label with True Type Font (TTF) font support.
Later, you will learn about layer and scene creation and transition. Then you will create the GUI parts essential for a game, such as buttons and switches. After that, you will breathe life into the game with background music and sound effects using the all new Cocos2d-x audio engine. You will then discover how to manage resource files and implement processes that depend on the operating system.
Finally, you will learn about tools that will help you make games more robust and stable, and get to know best practices to improve the game you have developed.
About The Author
Akihiro Matsuura has five years of experience as a Cocos2d-x developer. He founded his own company called Syuhari, Inc. five years ago. He has more than 20 years of experience as a programmer. He has written three technical books in Japanese. He also authored Cocos2d-x Recipe Book, Shuwa System Co., Ltd , the first Cocos2d-x book in Japan, iPhone SDK Recipe Book , Shuwa System Co., Ltd, and Cocos2d-x Guide Book, Mynavi Corporation.
7 years ago, iPhone3G was released in Japan. This was when he began to develop its software and ended up developing a lot of applications for iPhone. First, he developed them using Cocos2d for iPhone; however, he had to port to Android. So, he decided to use Cocos2d-x to develop cross-platform applications. At that time, Cocos2d-x was at version 1.0.
Since then, he has developed a lot of applications using Cocos2d-x.
Setting up the development environment, especially Android, is a bit tough. We will simplify it in this video.
Cocos2d-x is a cross-platform tool. The cocos command works for all platforms and you don't need to use an IDE if you don't want to. In this video, we take a look at this command and explain how to use it.
The cocos command can be really handy if you want to create a new project. However, if you have used Xcode or Eclipse, you can easily develop and debug using these tools. We'll see how to build our project using these tools in this video.
You may notice a difference in screen appearance on different devices. In this video, we will explain how to maintain the same resolution size regardless of screen size. Also, you know there are a lot of comments and lines of code in the template project. Let's remove them to get started with the original game right away.
Sprites are the most important aspects in games. We'll learn their basics in this video.
In order to animate and transform a sprite, you need to be able to tweak its properties. In this video, we'll see how to do that.
When the characters in a game start to move and perform actions, the game will come alive. Let's see it in action.
We'll build on the basic actions that we learned in the last video and create more complex actions.
Mastering actions requires you to be proficient in using advanced techniques. Let's see this in action.
Your game's performance will decline if the memory is not used efficiently. Also, a complex game will contain a lot of sprites. If the renderer speed is slow, the game might earn a bad review. We'll see how to solve these issues in this video.
Your game will get positive reviews if it's enhanced to have exciting features. This video will discuss two such features.
Drawing a shape in Cocos2d-x can be easy using the DrawNode class. However, you will to need to prepare textures for such shapes. In this video, we'll learn how to draw shapes without textures.
System fonts are the fonts already installed on your devices. Let's see how to use them to create labels.
You can install various true type fonts on your system. We'll learn how to create labels using these fonts.
Bitmap fonts are basically a bunch of characters with specific details about their size and position. Because of this, it's tricky to use them in your game. We'll cover how to create labels using these bitmap fonts.
There are various effects that can be used to enhance the look of our labels. Let's cover some of them.
A scene is a container that holds a Sprite, Labels, and other objects of your game. Creating and managing many scenes becomes difficult and we will resolve this in this video.
In order to improve the gameplay and flow of the game, our games have to transition between scenes. In this video, we will discuss how to facilitate this transition.
Many popular games display some effects when transitioning between scenes. There's only one pattern of creating them which we will discuss in this video.
Cocos2d-x has a lot of transitioning effects. However, if it does not have an effect that you need, it is difficult to create an original transitioning effect. But if you have the basic knowledge of transitioning effects, it's possible to create original transitions. We will show you how to create them.
A layer is a transparent sheet similar to Photoshop's layer. All the objects that need to be displayed are added to a layer. A scene can have multiple layers.
A menu is a very important component for any game and it's really useful too. However, the steps to use a menu are a little complex. Let's see what we do here.
Unlike the previous versions of Cocos 2d-x, we have dedicated classes to create buttons and checkboxes. Let's see how to use them.
When we want to indicate the progress of a task, we can use loading bars. The slider will be used for tasks such as changing the volume of the sound or music.
To set nicknames or to get the player's input text, you can use the TextField class.
We'll look at creating different types of views for our game in this video.
In this video, we will learn how to play background music in our game.
In this video, we will play the sound effect using SimpleAudioEngine.
A game will sound perfect if its volume and pitch are perfect. So in this video, we will learn how to control them.
We do not require our background music to play continuously. Hence we need to know how to pause and resume it.
We can pause and stop our sound effects as and when we want, which we will see in this video.
SimpleAudioEngine can't play multiple background videos. Hence we will learn to use AudioEngine in this video.
Videos enrich the presentation of a game. Hence we need to learn how to play movies in the game.
This video helps us to search path mechanism for solving this problem and update a new version of resources.
The aim of this video is to explain how to set up and use SQLite in Cocos2d-x.
This video shows us how to use and parse .xml , .plist, and .json files.
There are many tools available for you that you can use to enhance your game using Cocos-2dx. You can use original fonts and create sprite sheets, a map like a role-playing game, complex physical objects, and so on. In this section, you will learn how to use these extra tools in your game development.
You may require a simple way to decide what should be at the cell location. The Tiled Map Editor fulfils this task. A tiled map is a grid of cells where the value in the cell indicates what should be at the Location
The most important thing in gaming is to get the properties of the objects you have used in your gaming. This is what we are going to learn next.
Defining complex shapes in a game is a difficult task and time consuming process with tradition coding methods. PhysicsEditor enables us to perform this task in a smart way.
We sometimes need to deal with fonts in our game. Graphics and text are two different things difficult to club with ease. Here, in these video we will learn how to use the fonts at its best.
It is easy for a hacker to extract resource files from the application. To avoid that, TexturePacker can encrypt sprite sheets.
In a smartphone, the game frequently downloads a zip file from the server to update resources which are generally the main targets for hackers. Let's see how to protect them.
We often use SQLite to save the user data or game data. Cheaters will get the database file from your game's sand box to hack into the game.
Event Dispatcher is a mechanism for responding to events. You can get an event using Event Dispatcher. In addition, you can create Observer Pattern in the design patterns using it. Let's see how to do it.
There aren't any games developed without networking. Let's see how to use it in this video.
Packt has been committed to developer learning since 2004. A lot has changed in software since then - but Packt has remained responsive to these changes, continuing to look forward at the trends and tools defining the way we work and live. And how to put them to work.
With an extensive library of content - more than 4000 books and video courses -Packt's mission is to help developers stay relevant in a rapidly changing world. From new web frameworks and programming languages, to cutting edge data analytics, and DevOps, Packt takes software professionals in every field to what's important to them now.
From skills that will help you to develop and future proof your career to immediate solutions to every day tech challenges, Packt is a go-to resource to make you a better, smarter developer.
Packt Udemy courses continue this tradition, bringing you comprehensive yet concise video courses straight from the experts.