Build games with Cocos2d

Cocos2d is an open source software framework that is used to build games, apps and other cross-platform GUI-based interactive programs. It is written in Python using pyglet library and features flow control, fast and easy sprites, big number of transitions, actions that allow you to animate quicker, and access to OpenGL functionality.

Cocos2D in PythonCocos2d is reliable and mature open source software framework that is used to build 2D games, apps and other cross-platform GUI-based interactive programs. It is written in Python using pyglet library. Cocos2d is one of the few Python game libraries, other than PyGame.

Cocos2d’s core element is sprite. Basically, it is a simple 2D image that can also contain other sprites. They can be moved, scaled, rotated, have their image changed, etc. Using basic animation primitives, actions and timers Cocos2D allows to manipulate the size, scale, position, and other effects of the sprite in order to form more complex animations.

Sprites can be arranged together to form a scene (like a game level or a menu). Cocos2d’s application (also called a "scene based application") consists of different scenes and a workflow that connects several of them. Each scene is composed of an arbitrary number of layers that contain all of the game/application logic (e.g. handle events, draw to the screen using the pyglet and OpenGL APIs, etc.).

Cocos2d makes the game development easy and structured with:

  • fast and simple sprites;
  • GUI elements for game scenes (text boxes, labels, menus, buttons, etc.);
  • composable actions (move, rotate, scale and much more);
  • built-in classes to construct menus;
  • basic pure Python support for collisions;
  • powerful flow control via scenes;
  • support for rectangular and hexagonal tiled maps;
  • rich set of transitions and effects (waves, twirl, lens, etc.);
  • built-in Python Interpreter for debugging;
  • OpenGL and pyglet support;
  • text rendering (Label and HTMLLabel with action support).

The Cocos2D Family of Game Engines

Cocos2d (written in Python) is the project that inspired and started Cocos2d’s "family of game engines":

  • Cocos2D-x is a framework written in C++, with a thin platform-dependent layer.
  • Cocos2D-JS is a JavaScript version of Cocos2d-x engine targeted at HTML5-ready browsers. It supports full Cocos2d-x functionality with a set of simplified JavaScript-friendly APIs.
  • Cocos2D-XNA is a 2D/3D game framework written in C# specifically for XNA. It supports the Microsoft and MonoGame platforms.
  • Cocos2D-Swift is an open-source framework for building cross-platform 2D games with Xcode and Objective-C.
  • Others are targeted at specific platforms: Cocos2D-html5, Cocos2D-iphone, Cocos2D-windows, Cocos2D-android.

Interested in Cocos2d?

Simple architecture and usage of the Python programming language made Cocos2d cross-platform and well suited for fast prototyping and testing of game concepts. The flow control, fast and easy sprites, big number of transitions, actions that allow you to animate quicker, and access to OpenGL functionality - only some reasons why Cocos2d is worth your time. To know more visit python.cocos2d.org.

Connect with our experts Let's talk