Home/Projects/Platformer Game
All Projects

Platformer Game

Completed

A browser-based 2D platformer game built from scratch in vanilla JavaScript

JavaScriptCanvas APIHTML5

Motivation

I wanted to deeply understand how game engines work by building one from scratch — no libraries, no frameworks, just JavaScript and the Canvas API.

Architecture

Pure JavaScript game loop using requestAnimationFrame. Custom collision detection, physics simulation, sprite rendering, and level loading from JSON configuration files.

Features

  • Custom physics engine with gravity and friction
  • Collision detection with AABB (axis-aligned bounding box)
  • Sprite animation system
  • Level editor for creating custom levels
  • Collectibles and scoring system
  • Keyboard controls with coyote time and jump buffering

Challenges

  • Implementing stable collision detection that handles corner cases
  • Getting the physics to feel satisfying (jump arc, acceleration curves)
  • Building a level editor without a GUI framework

Lessons Learned

  • Game feel is as important as correctness — physics should feel good, not just be accurate
  • Separation of concerns matters even in small projects
  • requestAnimationFrame timing is nuanced; fixed timestep is better than variable

Future Plans

  • Mobile touch controls
  • Sound effects and background music
  • Online leaderboard for speedrunners