beginner

Build a 2D Platformer

Everything you need to create a complete 2D platformer from scratch — movement, camera, advanced mechanics, health, collectibles, and transitions.

8 scripts · 1 system

Learning Path

Follow these steps in order to build your 2D Platformer.

Included Scripts

Movement Beginner

2D Player Controller

Complete 2D character controller with smooth movement, variable-height jumping, and coyote time.

2D PlatformerGeneral
[RequireComponent(typeof(Rigidbody2D))]
public class PlayerController2D : MonoBehaviour
{
    [SerializeField] private float moveSpeed = 8f;
    [SerializeField] private float jumpForce = 16f;
    [SerializeField] private float coyoteTime = 0.15f;
2022.3+ · 3.2 KB
Movement Beginner

Smooth Camera Follow 2D

Smooth camera follow with offset, dead zone, and look-ahead for 2D games.

2D PlatformerGeneral
public class CameraFollow2D : MonoBehaviour
{
    [SerializeField] private Transform target;
    [SerializeField] private Vector3 offset = new Vector3(0f, 1f, -10f);
    [SerializeField] private float smoothSpeed = 8f;
2022.3+ · 1.8 KB
Movement Intermediate

2D Platformer Mechanics

Wall jump, wall slide, dash, and double jump mechanics for 2D platformers. Drop-in extension for ...

2D Platformer
[RequireComponent(typeof(Rigidbody2D))]
public class PlatformerMechanics2D : MonoBehaviour
{
    [SerializeField] private bool enableWallJump = true;
    [SerializeField] private bool enableDoubleJump = true;
    [SerializeField] private bool enableDash = true;
2022.3+ · 3.5 KB
Health & Combat Beginner

Health System

Reusable health component with damage, healing, invincibility frames, and events.

PlatformerFPS
public class HealthSystem : MonoBehaviour
{
    [SerializeField] private float maxHealth = 100f;
    public float HealthPercent => currentHealth / maxHealth;
    public void TakeDamage(float damage)
    public void Heal(float amount)
2022.3+ · 2.4 KB
Inventory Beginner

Pickup / Collectible

Collectible item with bobbing animation, rotation, magnet pull, and event callbacks for coins, he...

PlatformerRPG
public class Collectible : MonoBehaviour
{
    [SerializeField] private int value = 1;
    [SerializeField] private string itemId = "coin";
    private void OnTriggerEnter(Collider other)
    private void OnTriggerEnter2D(Collider2D other)
2022.3+ · 2.0 KB
UI Beginner

Screen Fader

Simple screen fade-in/fade-out with configurable color and duration. Great for scene transitions.

General
public class ScreenFader : MonoBehaviour
{
    public static ScreenFader Instance { get; private set; }
    public Coroutine FadeIn(float duration = -1f)
    public Coroutine FadeOut(float duration = -1f)
2022.3+ · 1.6 KB
UI Beginner

Health Bar UI

World-space or screen-space health bar with smooth fill, color gradient, and damage flash. Attach...

RPGFPS
public class HealthBarUI : MonoBehaviour
{
    [SerializeField] private float smoothSpeed = 5f;
    [SerializeField] private Gradient colorGradient;
    public void SetHealth(float current, float max)
2022.3+ · 2.4 KB
UI Beginner

Damage Popup

Floating damage numbers that animate upward and fade out. Supports critical hits, healing, and cu...

RPGGeneral
public class DamagePopup : MonoBehaviour
{
    public static DamagePopup Create(
        Vector3 position, float amount,
        bool isCritical = false, bool isHeal = false)
2022.3+ · 2.6 KB

Related Systems

2D Platformer Starter Kit

beginner 6 files

Complete 2D platformer foundation with movement, camera, advanced mechanics, health, collectibles, and transitions.

Platformer
Complete character controller with coyote time and jump buffering Wall jump, wall slide, dash, and double jump mechanics Smooth camera follow with look-ahead and dead zone Health system with invincibility frames and events