Skip to main content

Building a 2D Platformer - Overview

This tutorial series will guide you through creating a simple 2D platformer game using cocos2d-mono with DesktopGL. We'll break this down into manageable parts, each with clear checkpoints so you can track your progress.

Tutorial Structure​

This tutorial is divided into several parts, each building upon the previous one:

Part 1: Project Setup and Assets​

  • Setting up a cocos2d-mono DesktopGL project
  • Creating and organizing game assets
  • Setting up the content pipeline
  • Checkpoint: A working project that displays a background

Part 2: Physics Foundation​

  • Implementing Box2D physics
  • Creating physics helper utilities
  • Understanding coordinate systems
  • Checkpoint: A physics world with gravity

Part 3: Player Character​

  • Creating the player character
  • Implementing basic movement
  • Adding animations and sprites
  • Checkpoint: A controllable character that moves and animates

Part 4: Platforms and Collision​

  • Creating platform objects
  • Implementing collision detection
  • Adding jump mechanics
  • Checkpoint: A character that can jump on platforms

Part 5: Game Mechanics​

  • Adding collectible items
  • Implementing scoring system
  • Creating UI elements
  • Checkpoint: A playable game with collectibles and score

Part 6: Enemies and Simple AI​

  • Patrolling enemies built on the physics patterns from earlier parts
  • Stomp-to-defeat with a head sensor (the foot sensor's mirror image)
  • Side-hit consequences and player respawn
  • Checkpoint: A game that fights back

What You'll Learn​

Throughout this tutorial series, you'll master:

  • Setting up a cocos2d-mono DesktopGL project
  • Implementing Box2D physics for realistic movement
  • Creating a player character with controls
  • Building platforms and obstacles
  • Implementing collision detection
  • Adding game mechanics like jumping and double-jumping
  • Creating a simple level design
  • Adding game UI elements
  • Polishing the game with effects and sound

Prerequisites​

Before you begin, make sure you have:

  • Visual Studio 2019 or newer installed
  • .NET Core SDK installed
  • Basic C# knowledge
  • cocos2d-mono installed (see Environment Setup)

Final Result​

By the end of this tutorial series, you'll have built a complete 2D platformer featuring:

  • Physics-based character movement
  • Jump and double-jump mechanics
  • Collectible items and scoring
  • Sound effects and animations
  • A polished user interface

Getting Started​

Ready to start building? Head over to Part 1: Project Setup and Assets to begin your platformer journey!

Full Project Reference​

You can check out the complete platformer project here for reference. The full project contains all the assets used like sprites and sound effects.