Build a 2D Platformer
Everything you need to create a complete 2D platformer from scratch — movement, camera, advanced mechanics, health, collectibles, and transitions.
Learning Path
Follow these steps in order to build your 2D Platformer.
Included Scripts
2D Player Controller
Complete 2D character controller with smooth movement, variable-height jumping, and coyote time.
- Variable-height jumping with configurable force
- Coyote time for forgiving edge jumps
- Jump buffering for responsive input queuing
Smooth Camera Follow 2D
Smooth camera follow with offset, dead zone, and look-ahead for 2D games.
- Smooth Lerp-based camera following with adjustable speed
- Configurable offset for custom framing
- Look-ahead in movement direction for better visibility
2D Platformer Mechanics
Wall jump, wall slide, dash, and double jump mechanics for 2D platformers. Drop-in extension for the 2D Player Controller.
- Wall slide with configurable slide speed when pressing into walls
- Wall jump that launches away from the wall with adjustable force vector
- Double jump (or triple+) with configurable max air jumps
Health System
Reusable health component with damage, healing, invincibility frames, and events.
- Damage and healing with clamped health values
- Invincibility frames with configurable duration after taking damage
- UnityEvent callbacks for health changed, damaged, healed, and death
Pickup / Collectible
Collectible item with bobbing animation, rotation, magnet pull, and event callbacks for coins, health, ammo, etc.
- Configurable bob and rotate animation with adjustable speed and height
- Magnet attraction that pulls collectibles toward the player automatically
- Supports both 3D and 2D trigger detection out of the box
Screen Fader
Simple screen fade-in/fade-out with configurable color and duration. Great for scene transitions.
- Smooth alpha fade-in and fade-out with configurable duration
- FadeOutAndIn combo with callback action at the midpoint
- Configurable fade color for black, white, or custom transitions
Health Bar UI
World-space or screen-space health bar with smooth fill, color gradient, and damage flash. Attach to enemies or use as HUD.
- Smooth fill animation with Lerp for satisfying health changes
- Color gradient that shifts from green to yellow to red automatically
- Damage flash effect on the background image when health decreases
Damage Popup
Floating damage numbers that animate upward and fade out. Supports critical hits, healing, and custom colors.
- Static Create() factory method — no prefab setup required
- Separate colors for normal damage, critical hits, and healing
- Scaled-up text for critical hits with configurable crit scale
Related Systems
2D Platformer Starter Kit
Complete 2D platformer foundation with movement, camera, advanced mechanics, health, collectibles, and transitions.