HTML and CSS Reference
In-Depth Information
Chapter 24
Building a Game with the
Cocos2d-html5 Library
Shun Lin, Founder, Cocos2d-html5
HTML5 games are becoming more and more important in the mobile gaming industry. There are already many
casual and social games available in HTML5. Compared to native games, HTML5 games support real-time updating,
click-to-play without the need for installations, and efficient development cycles.
Cocos2d-html5 was created for HTML5 game development, focusing on mobile web games and hybrid games via
Cocos2d JavaScript Binding (JSB). The Cocos2d JSB is a wrapper code that sits between native code and JavaScript.
It enables HTML5 developers who don't have experience in C++ and mobile app development to make games with
Cocos2d-html5 and then deploy them as native mobile apps.
In this section, I will introduce the core concepts of Cocos2d-html5 and set up a working demo to demonstrate
how easy it can be to build a game. The game can run on desktop browsers or mobile browsers, and it can also run as
a native app with native performance without any change to the game code.
What Is Cocos2d?
The original Cocos2d is a game framework written in Python, and it inspired the creation of Cocos2d-iPhone, Cocos2d-x,
and Cocos2d-html5, which has rocked the mobile gaming industry with over a 25 percent adoption rate by game
developers. Some of the reasons why Cocos2d is so appealing are the flow control via scenes, a plethora of transitions,
fast and easy sprites, actions that allow you to animate everything easily, tiled maps, menus, and OpenGL support.
Why Was Cocos2d Created?
Before Cocos2d was created, the process of creating a 2D game was not easy, as developers had to build all of the
components they needed for game development. The original Cocos2d developers decided to build a lighter and
faster framework for game development without reinventing the wheel. Cocos2d makes many of the core concepts of
a 2D game clearer and easier.
What Makes Cocos2d the Best Choice for Your 2D Game Development?
A large number of games in the Apple App Store and Google Play are made with Cocos2d, including many best sellers.
There are over 400,000 Cocos2d developers around the world. Cocos2d is probably the de facto game engine in China
for mobile games, and it has been taught in a course at the South China University of Technology (SCUT).
Search WWH ::

Custom Search