A high-fidelity Super Mario Bros tribute built with TypeScript and HTML5 Canvas. This "Professional Edition" features advanced physics, parallax backgrounds, and a Neo-Retro UI with CRT scanline effects.
- Momentum-Based Movement: Acceleration and deceleration curves for a weightier, authentic feel.
- Variable Jump Height: Jump height is determined by how long the spacebar is held, allowing for precision platforming.
- Snappier Response: Optimized gravity and collision detection for a tight, professional "game feel."
- Parallax Backgrounds: Multi-layered backgrounds (mountains and clouds) that move at different speeds for depth.
- CRT Scanline Effect: A CSS-powered CRT filter and pixel-grid overlay for true retro immersion.
- Neo-Retro UI: Professional HUD using the 'Press Start 2P' font, featuring padded scores and "World 1-1" formatting.
- Dynamic Animations: Frame-rate independent animations that scale with movement speed.
- Multi-Stage Docker: Production-optimized Nginx serving for minimal image size.
- Docker Compose: Single-command orchestration for development and deployment.
- TypeScript Core: Fully typed game logic and entity management.
├── src/
│ ├── game/
│ │ ├── entities/ # Player, Enemy, Coin, Platform logic
│ │ ├── Game.ts # Central game controller
│ │ ├── GameRenderer.ts # Advanced Canvas rendering system
│ │ ├── SoundManager.ts # Web Audio API implementation
│ │ └── CollisionDetector.ts # AABB physics collision system
│ ├── styles/
│ │ └── game.css # CRT effects and Retro UI styling
│ └── main.ts # Application entry point
├── Dockerfile # Multi-stage production config
├── docker-compose.yml # Container orchestration
└── index.html # Main layout and UI structure
- Docker and Docker Compose (Recommended)
- OR Node.js 20+
-
Start the container:
docker compose up -d
-
Access the game: Open
http://localhost:8080in your browser. -
Stop the game:
docker compose down
-
Install dependencies:
npm install
-
Start dev server:
npm run dev
- ARROW LEFT/RIGHT: Move Mario (with momentum)
- SPACEBAR: Jump (Hold longer for higher jumps)
- R: Restart game
The project utilizes a Multi-Stage Docker Build:
- Stage 1 (Node.js): Compiles TypeScript and builds the Vite production bundle.
- Stage 2 (Nginx): Serves the static assets via a lightweight Alpine Nginx server.
This ensures the final production image is extremely small (~20MB) and highly secure.
This project is created for educational purposes. Super Mario Bros is a trademark of Nintendo.