CocosSharp is a library for building 2D games using C# and F#. It is a .NET port of the popular Cocos2D engine.
Introduction to CocosSharp
The CocosSharp 2D game engine provides technology for making cross-platform games. For a full list of supported platforms see the CocosSharp wiki on GitHub. These guides use C# for code samples, although CocosSharp is fully functional with F# as well.
The core of CocosSharp is provided by the MonoGame framework, which is itself a cross-platform, hardware accelerated API providing graphics, audio, game state management, input, and a content pipeline for importing assets. CocosSharp is an efficient abstraction layer well suited for 2D games. Furthermore, larger games can perform their own optimizations outside of their core libraries as games grows in complexity. In other words, CocosSharp provides a mix of ease of use and performance, enabling developers to get started quickly without limiting game size or complexity.
This hands-on video shows how to create a simple cross-platform CocosSharp game:
This guide describes BouncingGame, including how to work with game content, the various visual elements used to build a game, adding game logic, and more.
This guide describes the Fruity Falls game, covering common CocosSharp and game development concepts such as physics, content management, game state, and game design.
Coin Time is a full platformer game for iOS and Android. The goal of the game is to collect all of the coins in a level and then reach the exit door while avoiding enemies and obstacles.
CCDrawNode provides methods for drawing primitive objects such as lines, circles, and triangles.
CCAction is a base class that can be used to animate CocosSharp objects. This guide covers built-in
CCAction implementations for common tasks such as positioning, scaling, and rotating. It also looks at how to create custom implementations by inheriting from
Tiled is a powerful, flexible, and mature application for creating orthogonal and isometric tile maps for games. CocosSharp provides built-in integration for Tiled’s native file format.
The entity pattern is a powerful way to organize game code. It improves readability, makes code easier to maintain, and leverages built-in parent/child functionality.
This guide shows how to work with CocosSharp to develop games that display properly on devices of varying resolutions.
Content pipelines are often used in game development to optimize content and format it such that it can be loaded on certain hardware or with certain game development frameworks.
CCSpriteSheet provides functionality for combining and using many image files in one texture. Reducing texture count can improve a game’s load times and framerate.
CCTextureCache class provides a standard way to organize, cache, and unload content.
This guide covers 2D mathematics for game development. It uses CocosSharp to show how to perform common game development tasks and explains the math behind these tasks.
CCRenderTexture class provides functionality for rendering multiple CocosSharp objects to a single texture. Once created,
CCRenderTexture instances can be used to render graphics efficiently and to implement visual effects.